环境准备:
docker-complete 解压
su root
进入目录 rpm -Uvh *.rpm 安装docker
systemctl start docker
systemctl enable docker
修改docker 镜像存储位置
echo '{"data-root":"/app/docker","insecure-registries":["10.191.51.5"]}' > /etc/docker/daemon.json # 如有需要添加,"storage-driver": "devicemapper"
systemctl daemon-reload
systemctl restart docker.service
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