Skip to content

ES8 docker 集群

sh
sysctl -w vm.max_map_count=262144

vi /etc/sysctl.conf
vm.max_map_count=262144

echo "vm.max_map_count=262144" >> /etc/sysctl.conf

grep vm.max_map_count /etc/sysctl.conf

# 禁用交换
sudo swapoff -a
sed -i 's/.*swap.*/#&/' /etc/fstab

docker run --name esxmcback01 -p 9200:9200 -p 9300:9300 \
  --mount source=esxmcback01config,target=/usr/share/elasticsearch/config \
  --mount source=esxmcback01data,target=/usr/share/elasticsearch/data \
  -e "bootstrap.memory_lock=true" --ulimit memlock=-1:-1 \
  -e "discovery.type=single-node" \
  -it elasticsearch:8.8.1

docker run --name esxmcback02 -p 9200:9200 -p 9300:9300 \
  --mount source=esxmcback02config,target=/usr/share/elasticsearch/config \
  --mount source=esxmcback02data,target=/usr/share/elasticsearch/data \
  -e "bootstrap.memory_lock=true" --ulimit memlock=-1:-1 \
  -e "discovery.type=single-node" \
  -it elasticsearch:8.8.1


docker run --name eszz -p 9200:9200 -p 9300:9300 \
  --mount source=eszzconfig,target=/usr/share/elasticsearch/config \
  --mount source=eszzdata,target=/usr/share/elasticsearch/data \
  -e "bootstrap.memory_lock=true" --ulimit memlock=-1:-1 \
  -e "discovery.type=single-node" \
  -it elasticsearch:8.8.2


docker run --name esxmc -p 9200:9200 -p 9300:9300 \
  --mount source=esxmcconfig,target=/usr/share/elasticsearch/config \
  --mount source=esxmcdata,target=/usr/share/elasticsearch/data \
  -e "bootstrap.memory_lock=true" --ulimit memlock=-1:-1 \
  -e "discovery.type=single-node" \
  -it elasticsearch:8.8.2


docker run --name es01 --net elastic -p 9200:9200 \
  --mount source=es01config,target=/usr/share/elasticsearch/config \
  --mount source=es01data,target=/usr/share/elasticsearch/data \
  -e "bootstrap.memory_lock=true" --ulimit memlock=-1:-1 \
  -e "discovery.type=single-node" \
  -it elasticsearch:8.8.2

docker run -e ENROLLMENT_TOKEN="eyJ2ZXIiOiI4LjguMiIsImFkciI6WyIxNzIuMTguMC4yOjkyMDAiXSwiZmdyIjoiNWM1ZDM5YTZmZTVlNzA1NGNjODhjOWI4ZTM5MDAzYTZlNDI2OWUyMDlmNjIxY2U1NThjNTVkNjZjMTgwZjhkZiIsImtleSI6Ik1ocV9RNGtCeGVlUXM4NFp4cXI5Oi1wd0FkbDdYUzgyUmxOZS1IejhSeHcifQ==" --name es02 --net elastic -it elasticsearch:8.8.2

docker run -p 9202:9200 -e ENROLLMENT_TOKEN="eyJ2ZXIiOiI4LjguMiIsImFkciI6WyIxNzIuMTguMC4yOjkyMDAiXSwiZmdyIjoiNWM1ZDM5YTZmZTVlNzA1NGNjODhjOWI4ZTM5MDAzYTZlNDI2OWUyMDlmNjIxY2U1NThjNTVkNjZjMTgwZjhkZiIsImtleSI6Ik1ocV9RNGtCeGVlUXM4NFp4cXI5Oi1wd0FkbDdYUzgyUmxOZS1IejhSeHcifQ==" --name es02 --net elastic -it elasticsearch:8.8.2


docker run --name es02 --net elastic \
  -e ENROLLMENT_TOKEN="eyJ2ZXIiOiI4LjguMiIsImFkciI6WyIxNzIuMTguMC4yOjkyMDAiXSwiZmdyIjoiNWM1ZDM5YTZmZTVlNzA1NGNjODhjOWI4ZTM5MDAzYTZlNDI2OWUyMDlmNjIxY2U1NThjNTVkNjZjMTgwZjhkZiIsImtleSI6Ik1ocV9RNGtCeGVlUXM4NFp4cXI5Oi1wd0FkbDdYUzgyUmxOZS1IejhSeHcifQ==" \
  -it elasticsearch:8.8.2

docker run --name es02 --net elastic \
  --mount source=es02conf,target=/usr/share/elasticsearch/conf \
  --mount source=es02data,target=/usr/share/elasticsearch/data \
  -e "bootstrap.memory_lock=true" --ulimit memlock=-1:-1 \
  -e ENROLLMENT_TOKEN="eyJ2ZXIiOiI4LjguMiIsImFkciI6WyIxNzIuMTguMC4yOjkyMDAiXSwiZmdyIjoiNWM1ZDM5YTZmZTVlNzA1NGNjODhjOWI4ZTM5MDAzYTZlNDI2OWUyMDlmNjIxY2U1NThjNTVkNjZjMTgwZjhkZiIsImtleSI6Ik1ocV9RNGtCeGVlUXM4NFp4cXI5Oi1wd0FkbDdYUzgyUmxOZS1IejhSeHcifQ==" \
  -it elasticsearch:8.8.2