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