docker中介軟體搭建

Antony_hubei發表於2024-08-21

1. docker 搭建nacos 叢集 2.2.3

run -d -p 8848:8848 -p 9848:9848 -p 9849:9849 --restart=always --network=host -e NACOS_AUTH_ENABLE=true -e NACOS_AUTH_TOKEN=T20230703zxcvbnmasdfghjklqwertyuioT20230703zxcvbnmasdfghjklqwertyuio 
-e NACOS_AUTH_IDENTITY_KEY=admin2023 -e NACOS_AUTH_IDENTITY_VALUE=zxcvbnm2023 -e MODE=cluster -e NACOS_SERVERS='10.x.x.16:8848 10.x.x.17:8848 10.x.x.18:8848'
-e SPRING_DATASOURCE_PLATFORM=mysql -e MYSQL_SERVICE_HOST=10.x.x.129 -e MYSQL_SERVICE_PORT=3307 -e MYSQL_SERVICE_DB_NAME=nacos -e MYSQL_SERVICE_USER=nacos
-e MYSQL_SERVICE_PASSWORD=MMgj69aYUei#Utq -m 4072m --name nacos registry.xyz.com/docker/nacos/nacos-server:v2.2.3

2. docker 搭建es叢集

2.1 配置 es相關

elasticsearch.yml

cluster.name: elasticsearch-cluster
node.name: es-node3
network.host: 127.0.0.1
network.publish_host: 10.x.x.18
http.port: 9200
transport.port: 9300
http.cors.enabled: true
http.cors.allow-origin: "*"
#discovery.zen.ping.unicast.hosts: ["10.x.x.14:9300","10.x.x.13:9300","10.x.x.18:9300"]
#discovery.zen.minimum_master_nodes: 1
#node.master: true
cluster.initial_master_nodes: ["master","node"]
discovery.seed_hosts: ["10.x.x.14","10.x.x.13","10.x.x.18"]

2.2 執行docker命令

docker run -d --name es2 --privileged=true -p 9200:9200 -p 9300:9300 -e ES_JAVA_OPTS="-Xms10g -Xmx10g" -v /storage/config/es7/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml 
-v /storage/config/es7/data:/usr/share/elasticsearch/data -v /storage/config/es7/plugins:/usr/share/elasticsearch/plugins
-v /storage/config/es7/config/certs:/usr/share/elasticsearch/config/certs -m 15072m registry.xyz.com/docker/elasticsearch:7.17.2

3.docker 搭建logstash

3.1 配置logstash.yml

path.config: /usr/share/logstash/config/*.conf
path.logs: /var/log/logstash

3.2 執行命令

docker run -d --restart=always --network=host  --log-driver json-file  --log-opt max-size=100m  --log-opt max-file=4  -p 5055:5055 --name logsh  
-v /storage/config/logstash/logstash.yml:/usr/share/logstash/config/logstash.yml registry.xyz.com/docker/logstash:7.17.2

  

相關文章