1.安装JDK1.8-161
2.配置环境变量
3.增加用户(ElasticSearch不允许Root启动)
Root启动异常为:can not run elasticsearch as root
adduser chengjie
passwd chengjie
4.下载安装es
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.2.zip
5.修改ElasticSearch配置文件
vim config/elasticsearch.yml
#绑定端口信息
http.port: 9200
#绑定访问ip
network.host: 172.17.63.15
#去掉node.name注释
node.name: node-1
#指定集群节点信息
cluster.initial_master_nodes: ["node-1"]
6.启动ElasticSearch
注:启动前需给定足够权限
./bin/elasticsearch
./bin/elasticsearch -d(后台启动)
7.验证
curl "http://172.17.63.15:9200"
如出现一下内容,则说明es安装成功
{
"name" : "node-1", #节点名称
"cluster_name" : "elasticsearch", #集群名称
"cluster_uuid" : "OgLzegIGSuiPNfZvCSXeqw",
"version" : {
"number" : "7.1.1", #es版本号
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "7a013de",
"build_date" : "2019-05-23T14:04:00.380842Z",
"build_snapshot" : false,
"lucene_version" : "8.0.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
8.启动异常汇总
1./usr/local/elk/elasticsearch-7.1.1/config/jvm.options
原因:文件夹无读取权限
解决方案:切换至root权限下进行授权
2.can not run elasticsearch as root
原因: elasticsearch默认不能用root账户启动
解决方案:添加其他账户或者给系统现有账户授权elasticsearch目录
3.the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
修改【#cluster.initial_master_nodes: ["node-1", "node-2"] 】
clus ter.initial_master_nodes: ["node-1"]
4.bootstrap checks failed
max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
max number of threads [1024] for user [lishang] likely too low, increase to at least [2048]
vi /etc/security/limits.conf
添加如下内容:
soft nofile 65536
hard nofile 131072
soft nproc 2048
hard nproc 4096
hard nproc 4096
此文件修改后需要重新登录用户,才会生效
ubuntu系统解决方案:
1.vi /etc/security/limits.conf 添加如下内容:
soft nofile 65536
hard nofile 131072
soft nproc 2048
hard nproc 4096
hard nproc 4096
2.vi etc/systemd/user.conf
设置 DefaultLimitNOFILE=65536
3.修改 /etc/security/limits.conf 中如下面这几行(这将处理非图形登录):
* soft nofile 65535
* hard nofile 65535
4.一定要重启系统,不是注销用户
5.max number of threads [1024] for user [lish] likely too low, increase to at least [2048]
切换到root用户,进入limits.d目录下修改配置文件。
vi /etc/security/limits.d/90-nproc.conf
修改如下内容:
* soft nproc 1024
#修改为
* soft nproc 2048
6.max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
切换到root用户修改配置sysctl.conf
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
并执行命令:
sysctl -p
7.ax file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
修改切换到root用户修改配置limits.conf 添加下面两行
命令:vi /etc/security/limits.conf
* hard nofile 65536
* soft nofile 65536
切换到es的用户。