集群设备
ip | role |
---|---|
192.168.19.93 | master、data |
192.168.19.94 | data |
安装java
elasticsearch 需要java环境
elasticsearch-6.x 要求java版本1.8.0_131 or later
rpm -ivh http://192.168.19.111:8080/panjunbai/jdk-8u141-linux-x64.rpm
安装elasticsearch
可以使用yum源安装,也可以下载rpm包直接安装
cat /etc/yum.repos.d/elastic.repo [elasticsearch-6.x]name=Elasticsearch repository for 6.x packagesbaseurl=https://artifacts.elastic.co/packages/6.x/yumgpgcheck=1gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearchenabled=1autorefresh=1type=rpm-mdyum install -y elasticsearch
rpm -ivh http://192.168.19.111:8080/panjunbai/elasticsearch-6.2.4.rpm
配置elasticsearch通用配置
配置java运行内存大小,修改/etc/elasticsearch/jvm.options文件中-Xms -Xmx的值,为java虚拟机运行的内存最小和最大值,必须相同。其他使用默认值即可。
[root@es-2 elasticsearch]# cat /etc/elasticsearch/jvm.options |grep "^-Xm"-Xms6g-Xmx6g
创建elasticsearch运行的日志路径和数据路径
[root@es-2 elasticsearch]# mkdir /data/es-data[root@es-2 elasticsearch]# mkdir /data/es-log[root@es-2 elasticsearch]# chown -R elasticsearch.elasticsearch /data
192.168.19.93 elasticsearch 配置
[root@es-2 elasticsearch]# cat elasticsearch.yml |grep -v "^#"cluster.name: test-panjunbainode.name: node-94path.data: /data/es-datapath.logs: /data/es-lognetwork.host: 192.168.19.94http.port: 9200discovery.zen.ping.unicast.hosts: ["192.168.19.93", "192.168.19.94"]discovery.zen.minimum_master_nodes: 1node.master: truenode.data: true
192.168.19.94 elasticsearch 配置
[root@es-1 elasticsearch]# cat elasticsearch.ymlcluster.name: test-panjunbainode.name: node-93path.data: /data/es-datapath.logs: /data/es-lognetwork.host: 192.168.19.93http.port: 9200discovery.zen.ping.unicast.hosts: ["192.168.19.93", "192.168.19.94"]discovery.zen.minimum_master_nodes: 1node.master: falsenode.data: true
在192.168.19.93、192.168.19.94 启动elasticsearch
systemctl start elasticsearch
启动成功后访问结果
[root@es-2 es-log]# curl 192.168.19.93:9200{ "name" : "node-93", "cluster_name" : "test-panjunbai", "cluster_uuid" : "joXSilqGTiyvah-VcIqlYQ", "version" : { "number" : "6.2.4", "build_hash" : "ccec39f", "build_date" : "2018-04-12T20:37:28.497551Z", "build_snapshot" : false, "lucene_version" : "7.2.1", "minimum_wire_compatibility_version" : "5.6.0", "minimum_index_compatibility_version" : "5.0.0" }, "tagline" : "You Know, for Search"}[root@es-2 es-log]# curl 192.168.19.94:9200{ "name" : "node-94", "cluster_name" : "test-panjunbai", "cluster_uuid" : "joXSilqGTiyvah-VcIqlYQ", "version" : { "number" : "6.2.4", "build_hash" : "ccec39f", "build_date" : "2018-04-12T20:37:28.497551Z", "build_snapshot" : false, "lucene_version" : "7.2.1", "minimum_wire_compatibility_version" : "5.6.0", "minimum_index_compatibility_version" : "5.0.0" }, "tagline" : "You Know, for Search"}