xxl520 发表于 2019-1-28 12:28:08

ELK日志分析系统安装,多节点(二)

  ELK日志分析系统安装,多节点(二)
  
  
  在前面的单节点基础上更改:
  
  一、服务器时间同步:
  查看时间服务器的时间:
  # rdate time-b.nist.gov
  设置时间和时间服务器同步:
  # rdate -s time-b.nist.gov
  二、服务器免密登录:
  1、通过命令”ssh-keygen -t rsa“
  “.ssh”会生成以下几个文件
  authorized_keys:存放远程免密登录的公钥,主要通过这个文件记录多台机器的公钥
  id_rsa : 生成的私钥文件
  id_rsa.pub : 生成的公钥文件
  know_hosts : 已知的主机公钥清单
  2、通过ssh-copy-id的方式
  ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.92.33考到对应服务就可以免密登录了
  
  三、设置hosts:
  
  四、Elasticsearch多节点集群配置文件
  节点1:
http.port: 9200  
node.name: linux4
  
cluster.name: es_cluster
  
network.host: 0.0.0.0
  

  
discovery.zen.ping.unicast.hosts: ["192.168.32.44","192.168.32.55"]
  
discovery.zen.minimum_master_nodes: 2
  

  
bootstrap.memory_lock: false
  
bootstrap.system_call_filter: false
  
path.data: /usr/local/elasticsearch-5.3.0/data
  
path.logs: /usr/local/elasticsearch-5.3.0/logs
  

  
cluster.routing.allocation.disk.threshold_enabled: false
  
#cluster.routing.allocation.disk.watermark.low: 30gb
  
##cluster.routing.allocation.disk.watermark.high: 20g
  

  
http.cors.allow-origin: "/.*/"
  
http.cors.enabled: true
  节点2:
http.port: 9200  
node.name: linux5
  
cluster.name: es_cluster
  
network.host: 0.0.0.0
  

  
discovery.zen.ping.unicast.hosts: ["192.168.32.44","192.168.32.55"]
  
discovery.zen.minimum_master_nodes: 2
  

  
bootstrap.memory_lock: false
  
bootstrap.system_call_filter: false
  
path.data: /usr/local/elasticsearch-5.3.0/data
  
path.logs: /usr/local/elasticsearch-5.3.0/logs
  

  
cluster.routing.allocation.disk.threshold_enabled: false
  
#cluster.routing.allocation.disk.watermark.low: 30gb
  
##cluster.routing.allocation.disk.watermark.high: 20g
  

  
http.cors.allow-origin: "/.*/"
  
http.cors.enabled: true
  然后测试:
  因为只有两个节点的话会出现“脑裂”现象所以一般多节点为3个节点,因为只有两台机所以在一台机里面弄了两个节点方法如下:
ElasticSearch单机双实例的配置方法:
  一个服务器上开多个ES实例,以便达到充分利用资源的目的。
  
配置变更
  要做到单机上开多个实例,需要修改ES的默认配置,以下是一些配置要点:
node.max_local_storage_nodes
  这个配置限制了单节点上可以开启的ES存储实例的个数,我们需要开多个实例,因此需要把这个配置写到配置文件中,并为这个配置赋值为2或者更高。
http.port
  这个配置是elasticsearch对外提供服务的http端口配置,默认情况下ES会取用9200~9299之间的端口,如果9200被占用就会自动使用9201,在单机多实例的配置中这个配置实际是不需要修改的。
  但是为了更好地进行配置管理,以及和老的配置兼容,我们还是手动将第一个实例的http端口配置为9200,第二个实例配置为9201。
transport.tcp.port
  这个配置指定了elasticsearch集群内数据通讯使用的端口,默认情况下为9300,与上面的http.port配置类似,ES也会自动为已占用的端口选择下一个端口号。我们可以将第一个实例的tcp传输端口配置为9300,第二实例配置为9301。
  节点1:
  /usr/local/elasticsearch-5.3.0/config/elasticsearch.yml
http.port: 9200  
node.name: linux4
  
cluster.name: es_cluster
  
network.host: 0.0.0.0
  

  
node.max_local_storage_nodes: 2
  

  
discovery.zen.ping.unicast.hosts: ["192.168.32.44","192.168.32.55","192.168.32.44:9301"]
  
discovery.zen.minimum_master_nodes: 3
  

  
bootstrap.memory_lock: false
  
bootstrap.system_call_filter: false
  
path.data: /usr/local/elasticsearch-5.3.0/data
  
path.logs: /usr/local/elasticsearch-5.3.0/logs
  
cluster.routing.allocation.disk.threshold_enabled: false
  
#cluster.routing.allocation.disk.watermark.low: 30gb
  
##cluster.routing.allocation.disk.watermark.high: 20gb
  

  
http.cors.allow-origin: "/.*/"
  
http.cors.enabled: true
  节点2:
  /usr/local/elasticsearch-5.3.0-rep2/config/elasticsearch.yml
http.port: 9201  
transport.tcp.port: 9301
  
node.name: linux4-rep2
  
cluster.name: es_cluster
  
network.host: 0.0.0.0
  

  
node.max_local_storage_nodes: 2
  

  
discovery.zen.ping.unicast.hosts: ["192.168.32.44","192.168.32.55","192.168.32.44:9301"]
  
discovery.zen.minimum_master_nodes: 3
  

  
bootstrap.memory_lock: false
  
bootstrap.system_call_filter: false
  
path.data: /usr/local/elasticsearch-5.3.0-rep2/data
  
path.logs: /usr/local/elasticsearch-5.3.0-rep2/logs
  
cluster.routing.allocation.disk.threshold_enabled: false
  
#cluster.routing.allocation.disk.watermark.low: 30gb
  
###cluster.routing.allocation.disk.watermark.high: 20gb
  
#
  
http.cors.allow-origin: "/.*/"
  
http.cors.enabled: true
  另一台机改下配置文件的节点设置就是3个节点了
  节点3:
http.port: 9200  
node.name: linux5
  
cluster.name: es_cluster
  
network.host: 0.0.0.0
  

  
discovery.zen.ping.unicast.hosts: ["192.168.32.44","192.168.32.55","192.168.32.44:9301"]
  
discovery.zen.minimum_master_nodes: 3
  

  
bootstrap.memory_lock: false
  
bootstrap.system_call_filter: false
  
path.data: /usr/local/elasticsearch-5.3.0/data
  
path.logs: /usr/local/elasticsearch-5.3.0/logs
  

  
cluster.routing.allocation.disk.threshold_enabled: false
  
#cluster.routing.allocation.disk.watermark.low: 30gb
  
##cluster.routing.allocation.disk.watermark.high: 20g
  

  
http.cors.allow-origin: "/.*/"
  
http.cors.enabled: true
  本文转载自:
  http://www.linuxidc.com/Linux/2017-04/143181.htm
  http://blog.csdn.net/lw305080/article/details/52528731


页: [1]
查看完整版本: ELK日志分析系统安装,多节点(二)