.Net Core 下 ELK 实践
程序员文章站
2024-01-04 12:39:46
...
ES 安装部署
单节点部署
docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms100m -Xmx200m" elasticsearch:7.2.0
docker run -p 5601:5601 -d -e ELASTICSEARCH_URL=http://192.168.3.204:9200 -e ELASTICSEARCH_HOSTS=http://192.168.3.204:9200 kibana:7.2.0
ES 多节点集群
3. 调高jvm线程数限制
vim /etc/sysctl.conf
加入
vm.max_map_count=262144
执行生效
sysctl –p
或者直接执行下面代码
sysctl -w vm.max_map_count=262144
es1.yml
cluster.name: elasticsearch-cluster
node.name: es-node1
network.bind_host: 0.0.0.0
network.publish_host: 192.168.3.204
http.port: 9200
cluster.initial_master_nodes: ["192.168.3.204:9300"]
transport.tcp.port: 9300
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true
node.data: true
discovery.zen.ping.unicast.hosts: ["192.168.3.204:9300","192.168.3.204:9301","192.168.3.204:9302"]
discovery.zen.minimum_master_nodes: 2
es2.myl
cluster.name: elasticsearch-cluster
node.name: es-node2
network.bind_host: 0.0.0.0
network.publish_host: 192.168.3.204
http.port: 9201
cluster.initial_master_nodes: ["192.168.3.204:9300"]
transport.tcp.port: 9301
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true
node.data: true
discovery.zen.ping.unicast.hosts: ["192.168.3.204:9300","192.168.3.204:9301","192.168.3.204:9302"]
discovery.zen.minimum_master_nodes: 2
es3.yml
cluster.name: elasticsearch-cluster
node.name: es-node3
network.bind_host: 0.0.0.0
network.publish_host: 192.168.3.204
http.port: 9202
cluster.initial_master_nodes: ["192.168.3.204:9300"]
transport.tcp.port: 9302
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true
node.data: true
discovery.zen.ping.unicast.hosts: ["192.168.3.204:9300","192.168.3.204:9301","192.168.3.204:9302"]
discovery.zen.minimum_master_nodes: 2
启动 挂载数据目录
注意,必须在宿主机创建data文件夹,然后配置777权限,文件夹单独配置
#容器中日志文件夹目录
/usr/share/elasticsearch/logs
docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9200:9200 -p 9300:9300 -v /home/es/config/es1.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /home/es/data1:/usr/share/elasticsearch/data --name es01 docker.elastic.co/elasticsearch/elasticsearch:7.10.0
docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9201:9201 -p 9301:9301 -v /home/es/config/es2.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /home/es/data2:/usr/share/elasticsearch/data --name es02 docker.elastic.co/elasticsearch/elasticsearch:7.10.0
docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9202:9202 -p 9302:9302 -v /home/es/config/es3.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /home/es/data3:/usr/share/elasticsearch/data --name es03 docker.elastic.co/elasticsearch/elasticsearch:7.10.0
docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9200:9200 -p 9300:9300 -v /home/es/config/es1.yml:/usr/share/elasticsearch/config/elasticsearch.yml --name es01 docker.elastic.co/elasticsearch/elasticsearch:7.10.0
docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9201:9201 -p 9301:9301 -v /home/es/config/es2.yml:/usr/share/elasticsearch/config/elasticsearch.yml --name es02 docker.elastic.co/elasticsearch/elasticsearch:7.10.0
docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9202:9202 -p 9302:9302 -v /home/es/config/es3.yml:/usr/share/elasticsearch/config/elasticsearch.yml --name es03 docker.elastic.co/elasticsearch/elasticsearch:7.10.0
LOGSTASH 部署
logstash.yml 文件
http.host: "0.0.0.0"
xpack.monitoring.elasticsearch.hosts: [ "http://192.168.3.204:9200" ]
docker run --rm -it --privileged=true -p 9600:9600 -d -v /logstash/logstash.conf:/usr/share/logstash/pipeline/logstash.conf -v /logstash/log/:/home/public/ -v /logstash/logstash.yml:/usr/share/logstash/config/logstash.yml logstash:7.2.0
界面化工具
docker run --name eshd -p 9800:9800 containerize/elastichd:latest
docker run -d -p 3000:3000 --name=grafana grafana/grafana:latest
汉化
docker run -d -p 3000:3000 --name=grafana-cn w958660278/grafana-cn:latest
#-v D:/grafana/grafana-5.0.1/data:/var/lib/grafana
#-v D:/grafana/grafana-5.0.1/conf:/usr/share/grafana/conf
用户名密码默认 admin admin
docker run -p 9047:9047 -p 31010:31010 -p 45678:45678 dremio/dremio-oss:3.1.8
docker run -d --name cerebro -p 9000:9000 yannart/cerebro
# 其余推荐工具
https://blog.csdn.net/laoyang360/article/details/80645710