ELK日志分析系统安装和部署(2)

数据1节点配置:

vim /etc/elasticsearch/es-data1.yml # ======================== Elasticsearch Configuration ========================= # cluster.name: elk-cluster node.name: node-data1 node.attr.rack: r1 # ----------------------------------- Paths ------------------------------------ #设置data存放的路径为/dat1/elasticsearch/data path.data: /data1/elasticsearch/data #设置logs日志的路径为/data1/elasticsearch/logs path.logs: /data1/elasticsearch/logs # ---------------------------------- Network ----------------------------------- #本机地址 network.host: 192.168.6.108 #开启监听的端口为9201 http.port: 9201 #tcp通讯端口 transport.tcp.port: 9331 #是否作为主机 node.master: false #是否作为数据节点 node.data: true node.max_local_storage_nodes: 3 #在删除索引时,是否需要明确指定名称.该值为false时,则可通过正则或_all删除: action.destructive_requires_name: true # --------------------------------- Discovery ---------------------------------- #集群信息,默认的通讯接口是9300 discovery.zen.ping.unicast.hosts: ["192.168.6.108:9330", "192.168.6.108:9331","192.168.6.108:9332"] discovery.zen.ping_timeout: 60s action.auto_create_index: false # ---------------------------------- Gateway ----------------------------------- # # Block initial recovery after a full cluster restart until N nodes are started: #设置集群中N个节点启动时进行数据恢复,默认为1。 gateway.recover_after_nodes: 2 #设置初始化数据恢复进程的超时时间,默认是5分钟。 gateway.recover_after_time: 3m gateway.expected_nodes: 3 # ---------------------------------- Various ----------------------------------- #开启跨域访问支持,默认为false http.cors.enabled: true #跨域访问允许的域名地址,(允许所有域名)以上使用正则 http.cors.allow-origin: /.*/

数据2节点配置:

vim /etc/elasticsearch/es-data2.yml # ======================== Elasticsearch Configuration ========================= # cluster.name: elk-cluster node.name: node-data2 node.attr.rack: r1 # ----------------------------------- Paths ------------------------------------ #设置data存放的路径为/data2/elasticsearch/data path.data: /data2/elasticsearch/data #设置logs日志的路径为/data2/elasticsearch/logs path.logs: /data2/elasticsearch/logs # ---------------------------------- Network ----------------------------------- #本机地址 network.host: 192.168.6.108 #开启监听的端口为9202 http.port: 9202 #tcp通讯端口 transport.tcp.port: 9332 #是否作为主机 node.master: false #是否作为数据节点 node.data: true node.max_local_storage_nodes: 3 #在删除索引时,是否需要明确指定名称.该值为false时,则可通过正则或_all删除: action.destructive_requires_name: true # --------------------------------- Discovery ---------------------------------- #集群信息,默认的通讯接口是9300 discovery.zen.ping.unicast.hosts: ["192.168.6.108:9330", "192.168.6.108:9331","192.168.6.108:9332"] discovery.zen.ping_timeout: 60s #这个关闭了自动创建索引。为的也是安全考虑,否则即使是内网,也有很多扫描程序,一旦开启,扫描程序会自动给你创建很多索引。 action.auto_create_index: false # ---------------------------------- Gateway ----------------------------------- # # Block initial recovery after a full cluster restart until N nodes are started: #设置集群中N个节点启动时进行数据恢复,默认为1。 gateway.recover_after_nodes: 2 #设置初始化数据恢复进程的超时时间,默认是5分钟。 gateway.recover_after_time: 3m gateway.expected_nodes: 3 # ---------------------------------- Various ----------------------------------- #开启跨域访问支持,默认为false http.cors.enabled: true #跨域访问允许的域名地址,(允许所有域名)以上使用正则 http.cors.allow-origin: /.*/

使用外网搭建集群时需注意:
network.host需要修改为0.0.0.0,同时要暴露你的外网地址,代码如下:

network.host: 0.0.0.0 network.publish_host: xx.xx.xx.xx

discovery.zen.ping.unicast.hosts修改为各个服务器的外网地址和通讯端口即可。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/8a7db2ceedebd559742bca9cce74ced3.html