centos 7 安装 Elasticsearch 6.2.4

2019-08-25  本文已影响0人  不二不二熊

一、安装java环境

因为之前安装rocketmq已经配置过java环境了(最低要求jdk1.8),在此不在赘述~
详见:centos 7 安装 rocketMq 4.5.x(亲测可用)

二、安装Elasticsearch 6.2.4

1.下载压缩文件
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.4.tar.gz
2. 解压,移动至/opt 目录下
tar -xzvf  elasticsearch-6.2.4.tar.gz 
mv elasticsearch-6.2.4 /opt
3. 新建用户启动
 groupadd esgroup
useradd esuser -g esgroup -p 123456
cd /opt
chown -R esuser:esgroup elasticsearch-6.2.4
su esuser
cd bin/
./elasticsearch
vim bin/elasticsearch
##修改最大最小内存
ES_JAVA_OPTS="-Xms512m -Xmx512m"

bootstrap错误(如下)

ERROR: [2] bootstrap checks failed
[1]: max file descriptors [65535] 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]
su root
##1解决办法
vim /etc/security/limits.conf 
##将原配置65536 修改为65536
* soft nofile 65536
* hard nofile 65536
##2解决办法
vim /etc/sysctl.conf 
vm.max_map_count=655360
sysctl -p
cd config/
vim elasticsearch.yml
##开启远程访问
network.host: 0.0.0.0
su esuser
./elasticsearch -d
三、浏览器远程访问查看是否成功

浏览器输入:http://你的服务器外网ip:9200/,如下即代表安装成功

{
  "name" : "9eaFGgS",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "WtwB6QYqT42kC1SydokufQ",
  "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"
}
参考资料

CentOS7安装并运行Elasticsearch_6.5.1
elasticsearch 外网访问配置

上一篇下一篇

猜你喜欢

热点阅读