1、解压:
tar -zxvf elasticsearch-6.4.3.tar.gz
2、配置修改:
目录在/opt/elasticsearch-6.4.3/config/elasticsearch.yml下面,解开下面的注释
vim /opt/elasticsearch-6.4.3/config/elasticsearch.yml
ip地址为当前机器的ip地址
network.host: 192.168.116.128
es的web的端口号,9300内部通讯
http.port: 9200
3、安装
cd /opt/elasticsearch-6.4.3/bin
./elasticsearch
4、报错解决,不能使用root账号
[2019-12-09T15:52:39,578][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
操作命令
[root@ip-100 bin]# groupadd esgroup
[root@ip-100 bin]# useradd esyg -g -p 123456
useradd: group '-p' does not exist
[root@ip-100 bin]# useradd esyg -g esgroup -p 123456
[root@ip-100 bin]# chown -R esyg:esgroup /opt/elasticsearch-6.4.3
[root@ip-100 bin]# su esyg
[esyg@ip-100 bin]$
5、在su esyg之后,然后执行./elasticsearch安装之后报错是
ERROR: [2] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解决1-
vim /etc/sysctl.conf
vm.max_map_count=655360
sysctl -p
解决2-
vim /etc/security/limits.conf
加入四行:
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
6、最后重启服务器(使用esyg这个账号启动)
关闭防火墙:
systemctl stop firewalld.service
访问地址:成功
http://192.168.116.128:9200/
{
"name" : "nfauw-K",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "9gzQa7MkQ8esa4n_fSD6cQ",
"version" : {
"number" : "6.4.3",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "fe40335",
"build_date" : "2018-10-30T23:17:19.084789Z",
"build_snapshot" : false,
"lucene_version" : "7.4.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}