Zookeeper installation Configuration

Source: Internet
Author: User

Take 3.3.3 as an example (1)wget http://www.apache.org/dist//zookeeper/zookeeper-3.3.3/zookeeper-3.3.3.tar.gztar zxvf zookeeper-3.3.3.tar.gz  #解压cd zookeeper-3.3.3 #进入路径cp conf/zoo_sample.cfg conf/zoo.cfg  #zoo_sample.cfg是默认的配置文件,一般我们采取新建配置文件的方式(2)vi conf/zoo.cfgIf you do not need a cluster, the contents of Zoo.cfg are as follows: (where the data directory needs to be changed to your real output directory)tickTime=2000initLimit=10syncLimit=5dataDir=/home/dubbo/zookeeper-3.3.3/dataclientPort=2181If a cluster is required, the contents of the zoo.cfg are as follows: (where the Data directory and server address need to be changed to the information of your actual deployment machine)tickTime=2000initLimit=10syncLimit=5dataDir=/home/dubbo/zookeeper-3.3.3/dataclientPort=2181server.1=192.168.1.153:2555:3555server.2=192.168.1.154:2555:3555and place the myID file in the Data directory: (DataDir in the zoo.cfg above)mkdir datavi myidmyID indicates its own ID, corresponding to the server in zoo.cfg above. After the number, the content of the first is 1, the second set is 2, the contents are as follows:1(3) Start:./bin/zkServer.sh start(4) Close:./bin/zkServer.sh stop(5) Parameter resolution server. A=b:c:d: Where A is a number, indicating this is the first server, B is the IP address of this server, C is the server and the Leader server in the cluster to exchange information on the port; D means that in case the Leader server in the cluster hangs, a port is needed to re-elect , select a new Leader, which is the port that the server communicates with each other when the election is performed. If it is a pseudo-cluster configuration, because B is the same, so different Zookeeper instance communication port numbers can not be the same, so they should be assigned a different port number.

Create a myID file under data with the contents of 1

This content corresponds to this zookeeper order, the first zookeeper is 1, the second zookeeper is 2, there is no order, but can not be repeated.

It's best to match the X in server.x.

Additional parameters are described in the table below:

Name of parameter

Description

ClientPort

The client connects to the server's port, which is the external service port, and is typically set to 2181.

DataDir

The directory where the snapshot file snapshot is stored. By default, the transaction log is also stored here. It is recommended to configure parameter Datalogdir at the same time, and write performance of transaction log directly affects ZK performance.

Ticktime

A time unit in the ZK. All time in ZK is based on this time unit and is configured in integer multiples. For example, the minimum time-out period for a session is 2*ticktime.

Datalogdir

The transaction log output directory. Try to configure a separate disk or mount point for the output of the transaction log, which will greatly improve ZK performance.
(No Java system property)

Globaloutstandinglimit

Maximum number of request stacks. The default is 1000. While ZK is running, the server is still allowing clients to submit requests to the server to improve throughput performance, although it has no idle time to handle more client requests. Of course, in order to prevent server memory overflow, this request backlog number still need to be under the limit.
(Java system property:zookeeper.globaloutstandinglimit. )

Preallocsize

Pre-open disk space for subsequent writes to the transaction log. The default is 64M, and each transaction log size is 64M. If ZK has a large snapshot frequency, it is advisable to reduce this parameter appropriately. (Java system Property:zookeeper.preallocsize )

Snapcount

Once a snapshot (snapshot) is triggered for each snapcount transaction log output, ZK generates a snapshot.* file and creates a new transaction log file log.*. The default is 100000. (In a real code implementation, some random number processing is performed to prevent all servers from taking snapshots at the same time to affect performance) (Java system property:Zookeeper.snapcount )

Tracefile

Log that is used to log all requests, which can be used during general debugging, but is not recommended for production environments and can seriously affect performance. (Java system property:?) requesttracefile )

Maxclientcnxns

The limit on the number of connections between a single client and a single server is IP-level, default is 60, and if set to 0, there is no limit. Please note that this limitation is only limited by the number of connections between a single client machine and a single ZK server, not the specified client IP, nor the number of connections to the ZK cluster, nor the number of connections to all clients by a single ZK. Specify the client IP throttling policy, here's a patch that you can try: http://rdc.taobao.com/team/jm/archives/1334 (No Java system property)

Clientportaddress

For multi-NIC machines, you can specify a different listening port for each IP.  By default, all IPs are listening on the port specified by clientport . New in 3.3.0

Minsessiontimeoutmaxsessiontimeout

Session timeout limit, if the client set timeout time is not in this range, then it will be forced to set to the maximum or minimum time. The default session timeout is 2 * Ticktime * ticktime this range New in 3.3.0

Fsync.warningthresholdms

When the transaction log is output, if the call to the Fsync method exceeds the specified time-out, a warning message is output in the log. The default is 1000ms. (Java system Property: Fsync.warningthresholdms ) New in 3.3.4

Autopurge.purgeinterval

As mentioned above, 3.4.0 and later versions, ZK provides the ability to automatically clean up the transaction log and snapshot files, this parameter specifies the cleanup frequency, in hours, the need to configure a 1 or larger integer, the default is 0, that does not turn on the automatic cleanup function.  (No Java system property) New in 3.4.0

Autopurge.snapretaincount

This parameter is used in conjunction with the above parameter, which specifies the number of files that need to be preserved. The default is to keep 3.  (No Java system property) New in 3.4.0

Electionalg

In previous releases, this parameter configuration allowed us to choose the leader election algorithm, but since in later versions only a "tcp-based version of fast leader election" algorithm was left, this parameter does not seem to work at the moment, This is not a detailed expansion of the said. (No Java system property)

Initlimit

Follower during the boot process, all the latest data is synchronized from leader, and then the starting state of the external service is determined. Leader allows F to complete this work within Initlimit time. Normally, we don't have to be too concerned with setting this parameter. If the data volume of the ZK cluster is indeed very large, f at startup, the time to synchronize data from the leader will be correspondingly longer, so in this case it is necessary to adjust this parameter appropriately. (No Java system property)

Synclimit

During the operation, leader is responsible for communicating with all the machines in the ZK cluster, for example, through some heartbeat detection mechanisms, to detect the machine's survival status. If L make a heartbeat packet after Synclimit and have not received a response from F, then I think this f is out of line. Note: Do not set this parameter too large, or it may obscure some problems. (No Java system property)

Leaderserves

By default, leader accepts client connections and provides normal read and write services. However, if you want leader to focus on the coordination of the machines in the cluster, you can set this parameter to no, which greatly improves the performance of the write operation. (Java system Property:zookeeper. leaderserves ).

SERVER.X=[HOSTNAME]:NNNNN[:NNNNN]

The x here is a number that is consistent with the ID in the myID file. On the right can be configured with two ports, the first port for data synchronization between F and L and other communication, the second port is used to leader voting communication during the election process.
(No Java system property)

group.x=nnnnn[:nnnnn]weight.x=nnnnn

For machine grouping and weight setting, see here (No Java system property)

Cnxtimeout

Leader during an election, the time-out period for opening a connection is 5s by default.  (Java system Property:zookeeper. cnxtimeout )

Zookeeper. Digestauthenticationprovider
. superdigest

ZK permission settings are related, see " using Super identity to operate on privileged nodes " and " ZooKeeper permission Control "

Skipacl

No ACL checks are made on all client requests. If a permission limit is set on the previous node, it will be invalidated once the start is opened on the server. (Java system Property: Zookeeper.skipacl )

Forcesync

This parameter determines whether you need to call filechannel. Force to ensure that the data is fully synchronized to disk when the transaction log commits. (Java system Property: Zookeeper.forcesync )

Jute.maxbuffer

The maximum amount of data per node is 1M by default. This restriction must be set on both the server and client side to take effect. (Java system Property: Jute.maxbuffer )

Zookeeper installation Configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.