Elasticsearch集群安装部署

Elasticsearch版本

rpm -ivh elasticsearch-6.8.3.rpm

创建文件夹

mkdir /usr/share/elasticsearch/data
mkdir /usr/share/elasticsearch/logs

因为安全问题Elasticsearch不让用root用户直接运行,所以要创建新用户

创建用户命令
adduser es
修改用户密码
passwd es
将es解压目录的所有者授予此用户
chown -R es:es *

修改elasticsearch.yml文件

#vi /etc/elasticsearch/elasticsearch.yml
---------------------------------- Cluster -----------------------------------
cluster.name: es_cluster
------------------------------------ Node ------------------------------------
node.name: node_1
#----------------------------------- Paths ------------------------------------
path.data: /usr/share/elasticsearch/data
path.logs: /usr/share/elasticsearch/logs
#----------------------------------- Memory -----------------------------------
network.host: 0.0.0.0
http.port: 9200
transport.tcp.port: 9300
#--------------------------------- Discovery ----------------------------------
discovery.zen.ping.unicast.hosts: ["10.2.15.183", "10.2.15.169", "10.2.15.186"]
discovery.zen.minimum_master_nodes: 2
gateway.recover_after_nodes: 2
#---------------------------------- Various -----------------------------------
node.master: true
node.data: true
http.cors.enabled: true
http.cors.allow-origin: "*"

修改jvm.options文件

vi /etc/elasticsearch/jvm.options
-Xms4g
-Xmx4g

修改limits.conf文件

vi /etc/security/limits.conf
* soft nofile 65536
* hard nofile 131072
* soft nproc 4096
* hard nproc 4096

修改sysctl.conf文件

vi /etc/sysctl.conf
vm.max_map_count=655360

将/elasticsearch 发送给其他两个服务器hadoop2, hadoop3

scp -r /usr/local/elasticsearch hadoop2:/usr/local
scp -r /usr/local/elasticsearch hadoop3:/usr/local

切换至es用户并启动

su es
bin/elasticsearch

用浏览器访问es所在机器的9200端口 http://hadoop1:9200

你可能感兴趣的:(elasticsearch)