1、安装docker(分步执行,有些命令需要确认)
apt-get remove docker docker-engine docker.io containerd runc
apt-get update
apt-get install ca-certificates curl gnupg lsb-release
mkdir -p /etc/apt/keyrings
curl -fsSL <https://download.docker.com/linux/ubuntu/gpg> | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] <https://download.docker.com/linux/ubuntu> \\
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
chmod a+r /etc/apt/keyrings/docker.gpg
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
docker run hello-world
2、创建网桥(选择执行)(四台主机分别执行将子网的网段分开)
docker network create --driver=bridge --subnet=172.100.0.0/16 pinot-cluster
docker network create --driver=bridge --subnet=172.101.0.0/16 pinot-cluster
docker network create --driver=bridge --subnet=172.102.0.0/16 pinot-cluster
docker network create --driver=bridge --subnet=172.103.0.0/16 pinot-cluster
3、启动zookeeper
docker run \
--network=pinot-cluster \
--name pinot-zookeeper \
--restart always \
-p 2181:2181 \
-p 2888:2888 \
-p 3888:3888 \
-v /data/zookeeper/data:/data \
-v /data/zookeeper/conf:/conf \
-v /data/zookeeper/logs:/datalog \
-d zookeeper:3.5.6
4、拉取pinot镜像
docker pull apachepinot/pinot:0.11.0
5、启动Pinot Controller(跟zookeeper同一台宿主机时)
docker run -ti \
-v /data/pinot/data:/opt/pinot/data \
-v /data/pinot/logs:/opt/pinot/logs \
--network=pinot-cluster \
--name pinot-controller \
--restart always \
-p 8096:8096 \
-p 8097:8097 \
-p 8098:8098 \
-p 8099:8099 \
-p 9000:9000 \
-e JAVA_OPTS="-Dplugins.dir=/opt/pinot/plugins -Xms8G -Xmx8G -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -Xloggc:gc-pinot-controller.log" \
-d apachepinot/pinot:0.11.0 StartController \
-dataDir /opt/pinot/data/PinotController \
-controllerHost xxx.xxx.xxx.xxx \
-zkAddress pinot-zookeeper:2181
其中:xxx.xxx.xxx.xxx是当前主机与其他三台主机之间的内网地址
6、启动Pinot Broker(跟zookeeper不在同一台宿主机)
docker run -ti \
-v /data/pinot/logs:/opt/pinot/logs \
--network=pinot-cluster \
--name pinot-broker \
--restart always \
-p 8096:8096 \
-p 8097:8097 \
-p 8098:8098 \
-p 8099:8099 \
-p 9000:9000 \
-e JAVA_OPTS="-Dplugins.dir=/opt/pinot/plugins -Xms12G -Xmx12G -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -Xloggc:gc-pinot-broker.log" \
-d apachepinot/pinot:0.11.0 StartBroker \
-brokerHost xxx.xxx.xxx.xxx \
-zkAddress yyy.yyy.yyy.yyy:2181
其中:xxx.xxx.xxx.xxx是当前主机与其他三台主机之间的内网地址
yyy.yyy.yyy.yyy 是zookeeper所在主机的内网地址
7、启动server(跟zookeeper不在同一台宿主机)
(1)server1
docker run -ti \
-v /data/pinot/data:/opt/pinot/data \
-v /data/pinot/logs:/opt/pinot/logs \
--network=pinot-cluster \
--name pinot-server \
--restart always \
-p 8096:8096 \
-p 8097:8097 \
-p 8098:8098 \
-p 8099:8099 \
-p 9000:9000 \
-e JAVA_OPTS="-Dplugins.dir=/opt/pinot/plugins -Xms28G -Xmx28G -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -Xloggc:gc-pinot-server.log" \
-d apachepinot/pinot:0.11.0 StartServer \
-serverHost xxx.xxx.xxx.xxx \
-serverPort 8098 \
-dataDir /opt/pinot/data/pinotServerData \
-segmentDir /opt/pinot/data/pinotSegments \
-zkAddress yyy.yyy.yyy.yyy:2181
其中:xxx.xxx.xxx.xxx是当前主机与其他三台主机之间的内网地址
yyy.yyy.yyy.yyy 是zookeeper所在主机的内网地址
(2)server2
docker run -ti \
-v /data/pinot/data:/opt/pinot/data \
-v /data/pinot/logs:/opt/pinot/logs \
--network=pinot-cluster \
--name pinot-server \
--restart always \
-p 8096:8096 \
-p 8097:8097 \
-p 8098:8098 \
-p 8099:8099 \
-p 9000:9000 \
-e JAVA_OPTS="-Dplugins.dir=/opt/pinot/plugins -Xms28G -Xmx28G -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -Xloggc:gc-pinot-server.log" \
-d apachepinot/pinot:0.11.0 StartServer \
-serverHost xxx.xxx.xxx.xxx \
-serverPort 8098 \
-dataDir /opt/pinot/data/pinotServerData \
-segmentDir /opt/pinot/data/pinotSegments \
-zkAddress yyy.yyy.yyy.yyy:2181
其中:xxx.xxx.xxx.xxx是当前主机与其他三台主机之间的内网地址
yyy.yyy.yyy.yyy 是zookeeper所在主机的内网地址