How to Deploy Dubbo with Zookeeper on CentOS: Step‑by‑Step Guide
This guide walks through installing prerequisites, configuring Zookeeper as a registry, setting up Dubbo, and deploying Tomcat to access the Dubbo web console on a CentOS 6.9 environment.
Overview
Dubbo is an open‑source Java RPC framework that can use Apache Zookeeper as its service registry. Zookeeper provides centralized configuration, naming, synchronization, and group services.
1. Prepare the system
yum install -y gcc gcc-c++ vim-enhanced glibc make unzip openssl openssl-devel openssh-server openssh-clients wget2. Synchronize time
yum install -y ntp
/usr/sbin/ntpdate cn.pool.ntp.org
# Add to crontab to run hourly
* */1 * * * /usr/sbin/ntpdate cn.pool.ntp.org > /dev/null 2>&13. Install JDK and Zookeeper on 192.168.199.175
rpm -ivh jdk-7u55-linux-x64.rpm
tar zxvf zookeeper-3.4.5.tar.gz
cd zookeeper-3.4.5
cp conf/zoo_sample.cfg conf/zoo.cfgEdit conf/zoo.cfg with:
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/dubbo/zookeeper/data
clientPort=2181
server.1=192.168.199.175:2555:3555
server.2=192.168.199.176:2555:3555Create data directory and set the server id:
mkdir -p /dubbo/zookeeper/data
touch /dubbo/zookeeper/data/myid
echo 1 > /dubbo/zookeeper/data/myid4. Install JDK and Zookeeper on 192.168.199.176
Repeat the steps above, but set myid to 2:
rpm -ivh jdk-7u55-linux-x64.rpm
tar zxvf zookeeper-3.4.5.tar.gz
cd zookeeper-3.4.5
cp conf/zoo_sample.cfg conf/zoo.cfg
# same zoo.cfg content as host 175
mkdir -p /dubbo/zookeeper/data
touch /dubbo/zookeeper/data/myid
echo 2 > /dubbo/zookeeper/data/myid5. Start Zookeeper
On each host:
cd /root/zookeeper-3.4.5/bin
./zkServer.sh startSuccessful start prints:
JMX enabled by default
Using config: /root/zookeeper-3.4.5/conf/zoo.cfg
Starting zookeeper ... STARTED6. Deploy Dubbo admin console on 192.168.199.175
tar zxvf apache-tomcat-7.0.14.tar.gz
cd apache-tomcat-7.0.14
rm -rf webapps/ROOT
unzip /root/dubbo-admin-2.4.1.war -d webapps/ROOTEdit webapps/ROOT/WEB-INF/dubbo.properties:
dubbo.registry.address=zookeeper://192.168.199.175:2181
dubbo.admin.root.password=root
dubbo.admin.guest.password=guestStart Tomcat:
cd bin
sh startup.sh7. Verify deployment
Open a browser to http://192.168.199.175:8080. Log in with username root and password root. The Dubbo management console appears, confirming that Zookeeper and Dubbo are correctly configured and running.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Full-Stack DevOps & Kubernetes
Focused on sharing DevOps, Kubernetes, Linux, Docker, Istio, microservices, Spring Cloud, Python, Go, databases, Nginx, Tomcat, cloud computing, and related technologies.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
