Install Dubbo Registration Center (Zookeeper-3.4.6), dubbo registration zookeeper

Source: Internet
Author: User

Install Dubbo Registration Center (Zookeeper-3.4.6), dubbo registration zookeeper

Sample Video Tutorial: http://www.roncoo.com/course/view/f614343765bc4aac8597c6d8b38f06fd

 

Dubbo recommends using Zookeeper as the service registration center.

Http://www.roncoo.com/details? Cid = f614343765bc4aac8597c6d8b38f06fd

 

Configure the Registry server (192.168.3.71) and install Zookeeper:

1. Modify the/etc/hosts file of the operating system and add:

# Zookeeper servers

192.168.3.71 edu-provider-01

 

2. Go to http://apache.fayea.com/zookeeper/download zookeeper-3.4.6:

$ Wget http://apache.fayea.com/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz

 

3. Unzip the zookeeper installation package:

$ Tar-zxvf zookeeper-3.4.6.tar.gz

 

4. Create the following directories under the/home/wusc/zookeeper-3.4.6 directory:

$ Cd/home/wusc/zookeeper-3.4.6

$ Mkdir data

$ Mkdir logs

 

5. Copy the zoo_sample.cfg file under the zookeeper-3.4.6/conf directory and name it zoo. cfg.

$ Cp zoo_sample.cfg zoo. cfg

 

6. modify the configuration file zoo. cfg:

$ Vi zoo. cfg

 

# The number of milliseconds of each tick

TickTime = 2000

# The number of ticks that the initial

# Synchronization phase can take

InitLimit = 10

# The number of ticks that can pass

# Sending a request and getting an acknowledgement

SyncLimit = 5

# The directory where the snapshot is stored.

# Do not use/tmp for storage,/tmp here is just

# Example sakes.

DataDir =/home/wusc/zookeeper-3.4.6/

DataLogDir =/home/wusc/zookeeper-3.4.6/logs

# The port at which the clients will connect

ClientPort = 2181

#2888,3888 are election port

Server.1 = edu-provider-01: 2888: 3888

 

Where,

The 2888 port number is the port for communications between zookeeper services.

3888 is the port on which zookeeper communicates with other applications.

The edu-provider-01 is the host name that has mapped the IP in hosts.

 

InitLimit: This configuration item is used to configure Zookeeper to accept the client (the client mentioned here is not the client that the user connects to the Zookeeper server, but the Follower server connected to the Leader in the Zookeeper server cluster) the maximum heartbeat interval that can be tolerated during connection initialization. When the length of the heartbeat exceeds 10 (tickTime), the Zookeeper server does not receive the response from the client, which indicates that the connection to the client fails. The total length is 5*2000 = 10 seconds.

 

SyncLimit: This configuration item identifies the length of time for sending a message, request, and response between the Leader and Follower. The maximum length is 2*2000 = 4 seconds.

 

Server. A = B: C: D: where A is A number, indicating the server number; B is the IP address of the server or the host name mapped to the IP address in the/etc/hosts file. C indicates the port on which the server exchanges information with the Leader server in the cluster; D indicates that if the Leader server in the cluster fails, a port is required to re-elect and select a new Leader, which is the port used for inter-server communication during the election. For the pseudo cluster configuration method, because B is the same, different Zookeeper instance communication port numbers cannot be the same, so you need to assign them different port numbers.

 

7. Create a myid file under dataDir =/home/wusc/zookeeper-3.4.6/data

Edit the myid file and enter the corresponding number on the machine of the corresponding IP address. For example, on zookeeper, the content of the myid file is 1. If you only install and configure on a single point, there is only one server.1.

$ Vi myid

1

 

8. Modify vi/home/wusc/. bash_profile under the wusc user to add zookeeper Configuration:

# Zookeeper env

Export ZOOKEEPER_HOME =/home/wusc/zookeeper-3.4.6

Export PATH = $ ZOOKEEPER_HOME/bin: $ PATH

 

Make the configuration file take effect

$ Source/home/wusc/. bash_profile

 

9. Open the ports 2181, 2888, and 3888 to be used in the firewall.

Switch to the root user permission and run the following command:

# Chkconfig iptables on

# Service iptables start

Edit/etc/sysconfig/iptables

# Vi/etc/sysconfig/iptables

Add the following three lines:

-A input-m state -- state NEW-m tcp-p tcp -- dport 2181-j ACCEPT

-A input-m state -- state NEW-m tcp-p tcp -- dport 2888-j ACCEPT

-A input-m state -- state NEW-m tcp-p tcp -- dport 3888-j ACCEPT

 

Restart Firewall:

# Service iptables restart

 

View the firewall port status:

# Service iptables status

Table: filter

Chain INPUT (policy ACCEPT)

Num target prot opt source destination

1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED, ESTABLISHED

2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0

3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0

4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt: 22

5 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt: 2181

6 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt: 2888

7 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt: 3888

8 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

 

Chain FORWARD (policy ACCEPT)

Num target prot opt source destination

1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

 

Chain OUTPUT (policy ACCEPT)

Num target prot opt source destination

 

10. Start and test zookeeper (start with wusc user, do not use root ):

(1) Use the wusc user to go to the/home/wusc/zookeeper-3.4.6/bin directory and execute:

$ ZkServer. sh start

 

(2) enter the jps command to view the process:

$ Jps

1456 QuorumPeerMain

Jps 1475

 

QuorumPeerMain is the zookeeper process and starts normally.

 

(3) view the status:

$ ZkServer. sh status

 

 

(4) view the zookeeper service output information:

Because the service information output file is in/home/wusc/zookeeper-3.4.6/bin/zookeeper. out

$ Tail-500f zookeeper. out

 

11. Stop the zookeeper process:

$ ZkServer. sh stop

 

12. Configure zookeeper to start with wusc:

Edit the/etc/rc. local file and add:

Su-wusc-c '/home/wusc/zookeeper-3.4.6/bin/zkServer. sh start'

For more details, please pay attention to the following!

 

Related Article

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.