環境準備:docker
docker-complete 解壓json
su rootvim
進入目錄 rpm -Uvh *.rpm 安裝dockerapp
systemctl start dockerelasticsearch
systemctl enable dockertcp
修改docker 鏡像存儲位置unix
echo '{"data-root":"/app/docker","insecure-registries":["10.191.51.5"]}' > /etc/docker/daemon.json # 若有須要添加,"storage-driver": "devicemapper"rest
systemctl daemon-reloadcode
systemctl restart docker.serviceblog
useradd -d /app/elastic elastic
passwd elastic
echo 'vm.max_map_count=262144' >> /etc/sysctl.conf
sysctl -p
swarm中若想配置遠程訪問 、在/usr/lib/systemd/system/docker.service,配置遠程訪問。主要是在[Service]這個部分,加上下面兩個參數
# vim /usr/lib/systemd/system/docker.service [Service] ExecStart= ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
systemctl daemon-reload
1:將elastic用戶加入Docker用戶組
groupadd docker
gpasswd -a elastic docker
systemctl restart docker
最後設置docker 開機自啓動
2:將docker-compose-Linux-x86_64加入/usr/bin/docker-compose
chmod +x /usr/bin/docker-compose
3:修改存儲格式爲devicemapper #zookeeper節點必備
vi /etc/sysconfig/docker-storage
DOCKER_STORAGE_OPTIONS="--storage-driver devicemapper "
systemctl restart docker
4:su - elastic
10.194.131.133
elasticsearch
docker run -e ES_JAVA_OPTS="-Xms10G -Xmx10G" -d -p 9200:9200 -p 9300:9300 -v /app/elastic/es_docker/config/es1.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /app/elastic/es_docker/data1:/usr/share/elasticsearch/data --name ES01 10.191.51.5/elk/elasticsearch
docker run -e ES_JAVA_OPTS="-Xms10G -Xmx10G" -d -p 9201:9201 -p 9301:9301 -v /app/elastic/es_docker/config/es2.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /app/elastic/es_docker/data2:/usr/share/elasticsearch/data --name ES02 10.191.51.5/elk/elasticsearch
zookeeper
docker run -d --name zookeeper -p 2181:2181 -t 10.191.51.5/elk/wurstmeister/zookeeper:3.4.13
kafka
docker run -d --name kafka1 -p 9092:9092 -e KAFKA_BROKER_ID=1 -e KAFKA_ZOOKEEPER_CONNECT=10.194.131.133:2181 -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://10.194.131.133:9092 -e KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092 -t 10.191.51.5/elk/wurstmeister/kafka:2.1.1
docker run -d --name kafka2 -p 9093:9093 -e KAFKA_BROKER_ID=2 -e KAFKA_ZOOKEEPER_CONNECT=10.194.131.133:2181 -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://10.194.131.133:9093 -e KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9093 -t 10.191.51.5/elk/wurstmeister/kafka:2.1.1
docker run -d --name kafka3 -p 9094:9094 -e KAFKA_BROKER_ID=3 -e KAFKA_ZOOKEEPER_CONNECT=10.194.131.133:2181 -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://10.194.131.133:9094 -e KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9094 -t 10.191.51.5/elk/wurstmeister/kafka:2.1.1
10.194.131.134
elasticsearch
docker run -e ES_JAVA_OPTS="-Xms10G -Xmx10G" -d -p 9202:9202 -p 9302:9302 -v /app/elastic/es_docker/config/es3.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /app/elastic/es_docker/data3:/usr/share/elasticsearch/data --name ES03 10.191.51.5/elk/elasticsearch
docker run -e ES_JAVA_OPTS="-Xms10G -Xmx10G" -d -p 9203:9203 -p 9303:9303 -v /app/elastic/es_docker/config/es4.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /app/elastic/es_docker/data4:/usr/share/elasticsearch/data --name ES04 10.191.51.5/elk/elasticsearch
logtash
docker run -d -p 5044:5044 -p 9600:9600 -it -v /app/elastic/logstash_docker/config/:/usr/share/logstashconfig/ -v /app/elastic/logstash_docker/pipeline/:/usr/share/logstash/pipeline/ 10.191.51.5/elk/logstash:6.5.4