// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

[[configuration]]
== Configuration Management

=== Configuration Overview

All accumulo properties have a default value in the source code.  Properties can also be set
in accumulo-site.xml and in zookeeper on per-table or system-wide basis.  If properties are set in more than one location,
accumulo will choose the property with the highest precedence.  This order of precedence is described
below (from highest to lowest):

==== Zookeeper table properties
Table properties are applied to the entire cluster when set in zookeeper using the accumulo API or shell.  While table properties take precedent over system properties, both will override properties set in accumulo-site.xml

Table properties consist of all properties with the table.* prefix.  Table properties are configured on a per-table basis using the following shell commmand:

  config -t TABLE -s PROPERTY=VALUE

==== Zookeeper system properties

System properties are applied to the entire cluster when set in zookeeper using the accumulo API or shell.  System properties consist of all properties with a `yes` in the _Zookeeper Mutable_ column in the table below.  They are set with the following shell command:

  config -s PROPERTY=VALUE

If a table.* property is set using this method, the value will apply to all tables except those configured on per-table basis (which have higher precedence).

While most system properties take effect immediately, some require a restart of the process which is indicated in _Zookeeper Mutable_.

==== accumulo-site.xml

Accumulo processes (master, tserver, etc) read their local accumulo-site.xml on start up.  Therefore, changes made to accumulo-site.xml must rsynced across the cluster and processes must be restarted to apply changes.

Certain properties (indicated by a `no` in _Zookeeper Mutable_) cannot be set in zookeeper and only set in this file.  The accumulo-site.xml also allows you to configure tablet servers with different settings.

==== Default Values

All properties have a default value in the source code.  This value has the lowest precedence and is overriden if set in accumulo-site.xml or zookeeper.

While the default value is usually optimal, there are cases where a change can increase query and ingest performance.

==== ZooKeeper Property Considerations

Any properties that are stored in ZooKeeper should consider the limitations of ZooKeeper itself with respect to the
number of nodes and the size of the node data. Custom table properties and options for Iterators configured on tables
are two areas in which there aren't any failsafes built into the API that can prevent the user from making this mistake.

While these properties have the ability to add some much needed dynamic configuration tools, use cases which might fall
into these warnings should be reconsidered.

=== Configuration in the Shell

The `config` command in the shell allows you to view the current system configuration.  You can also use the `-t` option to view a table's configuration as below:

----
$ ./bin/accumulo shell -u root
Enter current password for 'root'@'accumulo-instance': ******

Shell - Apache Accumulo Interactive Shell
-
- version: 1.6.0
- instance name: accumulo-instance
- instance id: 4f48fa03-f692-43ce-ae03-94c9ea8b7181
-
- type 'help' for a list of available commands
-
root@accumulo-instance> config -t foo
---------+---------------------------------------------+------------------------------------------------------
SCOPE    | NAME                                        | VALUE
---------+---------------------------------------------+------------------------------------------------------
default  | table.balancer ............................ | org.apache.accumulo.server.master.balancer.DefaultLoadBalancer
default  | table.bloom.enabled ....................... | false
default  | table.bloom.error.rate .................... | 0.5%
default  | table.bloom.hash.type ..................... | murmur
default  | table.bloom.key.functor ................... | org.apache.accumulo.core.file.keyfunctor.RowFunctor
default  | table.bloom.load.threshold ................ | 1
default  | table.bloom.size .......................... | 1048576
default  | table.cache.block.enable .................. | false
default  | table.cache.index.enable .................. | false
default  | table.compaction.major.everything.at ...... | 19700101000000GMT
default  | table.compaction.major.everything.idle .... | 1h
default  | table.compaction.major.ratio .............. | 1.3
site     |    @override .............................. | 1.4
system   |    @override .............................. | 1.5
table    |    @override .............................. | 1.6
default  | table.compaction.minor.idle ............... | 5m
default  | table.compaction.minor.logs.threshold ..... | 3
default  | table.failures.ignore ..................... | false
----
