Zookeeper单节点搭建(Docker)
前言:因为最近刚刚换了家公司,公司的架构跟原来老公司差别还是比较大的。新公司使用的是Dubbo,而不是目前比较火的SpringCloud架构。所以又要开始一波新的学习~~
这里算是个人的一个学习笔记,在此记录,以便于日后翻阅(也希望能够有大佬指点指点)
docker-compose.yml
version: "3.8"
services:
zookeeper1:
image: zookeeper
restart: always
container_name: zookeeper_1
ports:
- "2181:2181"
environment:
ZOO_MY_ID: 1
volumes:
# 挂载配置文件
- ./conf:/conf
# 挂载数据
- ./data:/mydata
# 后台运行zookeeper
command: bin/zkServer.sh start-foreground
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.
# dataDir=/export/crawlspace/mahadev/zookeeper/server1/data
dataDir=/mydata
# the port at which the clients will connect
clientPort=2181
网友评论