Abstract: 1, it is recommended to use The ZooKeeper registry client dubo-2.3.3 or later

2. Zookeeper is a subproject of Apache Hadoop. It is recommended to use this registry in production environments.

3. Dubbo does not make any intrusive modifications to the Zookeeper server, and only needs to install the native Zookeeper server. All registry logical adaptation is completed when the Zookeeper client is called.

The registry

Optional solution: ZooKeeper or Redis

1. You are advised to use the ZooKeeper registry client of dubo-2.3.3 or later

2. Zookeeper is a subproject of Apache Hadoop. It is recommended to use this registry in production environments.

3. Dubbo does not make any intrusive modifications to the Zookeeper server, and only needs to install the native Zookeeper server. All registry logical adaptation is completed when the Zookeeper client is called.

Installing the Dubbo Registry (ZooKeeper-3.4.6)

1. Add the following information to the /etc/hosts file of the OS:

# zookeeper servers

xxx.xxx.xxx.xxx jeesmlsz-01

2, to http://apache.fayea.com/zookeeper/ to download zookeeper – 3.4.6:

$wgetapache.fayea.com/zookeeper/z…

Decompress the ZooKeeper installation package.

$tar – ZXVF zookeeper – 3.4.6. Tar. Gz

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

$CD/home/jeesml/zookeeper – 3.4.6

$mkdir data

$mkdir logs

5. Copy the zoo_sample. CFG file from the zookeeper-3.4.6/conf directory to zoo.cfg

$cp zoo_sample.cfg zoo.cfg

6, modify zoo. CFG configuration file:

$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 between

# 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/jeesml/zookeeper – 3.4.6 / data

DataLogDir = / home/jeesml/zookeeper – 3.4.6 / logs

# the port at which the clients will connect

clientPort=2181

8 are # 2888388 election port

server.1=jeesmlsz-01:2888:3888

Among them,

2888 Port number Is used for communication between ZooKeeper services.

3888 is the port used by ZooKeeper to communicate with other applications.

Jeesmlsz-01 is the host name whose IP address has been mapped to the hosts.

InitLimit: This configuration item is used to configure Zookeeper to accept clients. (The client is not the client that the user connects to the Zookeeper server, but is connected to in the Zookeeper server cluster

Leader of the followers

Maximum number of heartbeat intervals that the server can tolerate when initializing a connection. Zookeeper when the heartbeat duration (tickTime) exceeds 10

The server has not received a message from the client, indicating that the client failed to connect. The total length of time is 5 times 2000 is 10 seconds.

SyncLimit: This configuration item identifies the maximum number of Ticktimes between the Leader and Follower to send messages, request and reply. The total time is 2 x 2000=4 seconds.

Server. A=B:C:D: where A is A number indicating the number of the server. B

Is the IP address of the server or the host name mapped to the IP in the /etc/hosts file; C represents the server and the Leader in the cluster

Port on which the server exchanges information; D indicates that in case the Leader server in the cluster hangs, a port is needed to re-elect a new one

Leader, which is the port that the servers communicate with each other during elections. If the configuration mode is pseudo cluster, B is the same, so different ZooKeepers are used

Instance communication port numbers cannot be the same, so they should be assigned different port numbers

Create myID file under dataDir=/home/jeesml/zookeeper-3.4.6/data

Edit the myID file and enter the corresponding number on the machine with the corresponding IP. On ZooKeeper, the myID file is 1. If the installation configuration is done on a single point, there is only one Server.1.

$vi myid

1

8. Run the following command to modify the zooKeeper configuration: vi /home/jeesml/.bash_profile

# zookeeper env

Export ZOOKEEPER_HOME = / home/jeesml/zookeeper – 3.4.6

export PATH=$ZOOKEEPER_HOME/bin:$PATH

$source /home/jeesml/.bash_profile to enable the configuration file

9. Open ports 2181, 2888, and 3888 on the firewall to switch to user root 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

# service iptables restart

Check 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

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

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

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

Start and test ZooKeeper (jeesML, not root) :

(1) Go to /home/jeesml/zookeeper-3.4.6/bin as user jeesml and run the following command:

$zkServer.sh start

(2) Enter the JPS command to view the process:

$jps

1456 QuorumPeerMain

1475 Jps

QuorumPeerMain is the ZooKeeper process and is running properly

(3) Check the status:

$zkServer.sh status

(4) View the output of the ZooKeeper service.

The service information output file is in /home/jeesml/zookeeper-3.4.6/bin/zookeeper.out

$tail -500f zookeeper.out

11. Stop the ZooKeeper process:

$zkServer.sh stop

12. Configure zooKeeper to start as jeesml user:

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

Su – jeesml-c ‘/home/jeesml/zookeeper-3.4.6/bin/ zkserver. sh start’

Please stay tuned to learn with me how to Install dubbo-Dubbo Management Console (3)

The core technology: Maven, for Springmvc mybatis shiro, Druid, Restful, Dubbo, ZooKeeper, Redis, FastDFS, ActiveMQ, Nginx

1. Screenshot of the core code structure of the project





Key words: Maven, Springmvc Mybatis Shiro Druid Restful, Dubbo ZooKeeper, Redis, FastDFS, ActiveMQ, Nginx, database read and write separation

Willing to understand the framework technology or source code of friends directly ask to exchange technology: 2042849237

Some distributed solutions, friends who are willing to understand can find our team to discuss