Today, I learned that zookeeper has been deployed on both windows and Alibaba cloud ecs servers. I think it's OK. Let me tell you something to avoid stepping on the pit.
To see how windows is deployed, see
Link: https://blog.csdn.net/Fekerkk/article/details/108004177.
Here's how Alibaba cloud deploys:
First, create a path on the server (the three paths simulate three servers respectively)
/user/local/zookeeper-cluster/zookeeper-1 /user/local/zookeeper-cluster/zookeeper-2 /user/local/zookeeper-cluster/zookeeper-3
Then download zookeeper in zookeeper cluster (download is slow, etc.)
Download command: wget https://archive.apache.org/dist/zookeeper/zookeeper-3.4.9/zookeeper-3.4.9.tar.gz Decompression command: tar -zxvf zookeeper-3.4.9.tar.gz
After decompression, copy the unzipped folder zookeeper-3.4.9 to
zookeeper-1
zookeeper-2
zookeeper-3
These three directories
Then enter the zookeeper-1 folder, create a data folder, and create a myid file under the data folder
mkdir data cd data vi myid
Then write 1 in myid file (just write 1)
1
Then enter the zookeeper-3.4.9 folder under zookeeper-1, and then enter the conf folder to_ sample. The cfg file is copied and renamed to zoo. In this directory cfg
mv zoo_sample.cfg zoo.cfg
Enter zoo Cfg file
vim zoo.cfg
Make the following modifications. Don't change other paths (change the path yourself), but don't change the IP, that is 0.0.0.0. Don't change it. Just write what I wrote. Just change your file path. Don't move anything else
clientPort=2181 dataDir=/usr/local/zookeeper-cluster/zookeeper-1/data server.1=0.0.0.0:2881:3881 server.2=0.0.0.0:2882:3882 server.3=0.0.0.0:2883:3883 quorumListenOnAllIPs=true
Next, go to the bin folder under the zookeeper-3.4.9 folder to start:
./zkServer.sh start You can also check the status (but not necessary) ./zkServer.sh status
In this way, the first zookeeper in the zookeeper-1 directory is configured, and the other two are basically the same. The difference is that zookeeper-2 creates 2 in data/myid
2
zookeeper-3 create data/myid and write 3
3
There is also the difference between the zoo of zookeeper-2 This is written in the cfg file
clientPort=2182 dataDir=/usr/local/zookeeper-cluster/zookeeper-2/data server.1=0.0.0.0:2881:3881 server.2=0.0.0.0:2882:3882 server.3=0.0.0.0:2883:3883 quorumListenOnAllIPs=true
The difference from zookeeper-1 is that the port is changed to 2182 and the path is changed to zookeeper-2. The others are the same and there is no difference
The zoo from zookeeper-3 This is written in the cfg file
clientPort=2183 dataDir=/usr/local/zookeeper-cluster/zookeeper-3/data server.1=0.0.0.0:2881:3881 server.2=0.0.0.0:2882:3882 server.3=0.0.0.0:2883:3883 quorumListenOnAllIPs=true
Then start zookeeper-2 and zookeeper-3;
After starting, enter a command:
jps
Can see
This indicates that all three zookeeper s started successfully
The next step is to open alicloud ports. Just open ports 2181, 2182 and 2183.
Next, let's get dubbo
You just need to put dubbo-2.5 X \ Dubbo admin \ target path Copy the war file to the webapp of Tomcat on the server, restart tomcat, and then enter the url to see the information of Dubbo. Well, we have completed the installation and deployment of zoopeeker on the server
Next, if you want to test whether it works or not, you can write a project on this machine to test it
But one more thing to note:
When writing the configuration of zookeeper, the address is written like this: (I won't expose my public IP, just change your own IP)
zookeeper://Server public network IP address: 2181;zookeeper: / / server public network IP address: 2182;zookeeper: / / server public network IP address: 2183
If you want to test the project, you can go
Link: https://blog.csdn.net/Fekerkk/article/details/108004177.
It's very detailed here. Just change the address of zookeeper to the above one at that time
If you have any questions, let's talk again!!!