集群名称:YCXESClusterName
主节点名称:YCXESNodeMaster 192.168.1.35
从节点名称:YCXESNodeSlave 192.168.1.36
直接搭建 和 docker搭建
1、Elasticsearch
下载地址:https://www.elastic.co/cn/downloads/past-releases/elasticsearch-7-10-0
主节点
# 集群名称必须相同 cluster.name: YCXESClusterName # 节点名称 node.name: YCXESNodeMaster # 是否是master节点 node.master: true # 是否允许该节点存储索引数据 node.data: true # 绑定地址 network.host: 0.0.0.0 # http端口 http.port: 9200 # 集群主机列表 discovery.seed_hosts: ["192.168.1.35:9300","192.168.1.36:9300"] # 启动全新的集群时需要此参数,再次重新启动时此参数可免 cluster.initial_master_nodes: ["YCXESNodeMaster"] # 是否开启跨域访问 http.cors.enabled: true # 开启跨域访问后的地址限制,*表示无限制 http.cors.allow-origin: "*"
从节点
# 集群名称必须相同 cluster.name: YCXESClusterName # 节点名称 node.name: YCXESNodeSlave # 是否是master节点 node.master: false # 是否允许该节点存储索引数据 node.data: true # 绑定地址 network.host: 0.0.0.0 # http端口 http.port: 9200 # 集群主机列表 discovery.seed_hosts: ["192.168.1.35:9300","192.168.1.36:9300"] # 启动全新的集群时需要此参数,再次重新启动时此参数可免 cluster.initial_master_nodes: ["YCXESNodeMaster"] # 是否开启跨域访问 http.cors.enabled: true # 开启跨域访问后的地址限制,*表示无限制 http.cors.allow-origin: "*"
设置用户和组
# 设置用户和组 异常: can not run elasticsearch as root groupadd es useradd es -g es passwd es chown -R es:es elasticsearch-7.10.0 su es
常见错误
1、异常: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535] 解决: vim /etc/security/limits.conf 追加 * soft nofile 65536 * hard nofile 65536 退出重新登录后查看 ulimit -Sn ulimit -Hn 2、异常: max number of threads [3818] for user [es] is too low, increase to at least [4096] 解决: vim /etc/security/limits.conf 追加 * soft nproc 4096 * hard nproc 4096 退出重新登录后查看 ulimit -Sn ulimit -Hn 3、异常: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] 解决: vim /etc/sysctl.conf vm.max_map_count=655360 生效 sysctl -p 4、异常: Exception in thread "main" java.nio.file.AccessDeniedException: /usr/local/elasticsearch/elasticsearch-6.2.2-1/config/jvm.options elasticsearch用户没有该文件夹的权限,执行命令 chown -R es:es /ycx/elasticsearch/
2、Kibana
下载地址:https://www.elastic.co/cn/downloads/past-releases/kibana-7-10-0
编辑 conf/kibana.yml
server.host: "192.168.1.35"
elasticsearch.hosts: ["http://192.168.1.35:9200"]
3、Logstash
下载地址:https://www.elastic.co/cn/downloads/past-releases/logstash-7-10-0