ElasticSearch学习(二)ElasticSearch安装

CentOS 6下安装Elasticsearch6.2.4

1、首先需要安装JDK环境

自行百度安装

2、下载elasticsearch 官网下载

https://www.elastic.co/downloads/past-releases/elasticsearch-6-2-4

下载之后上传到Linux 

3、解压缩

[hadoop@hadoop01 ~]$ tar -zxvf elasticsearch-6.2.4.tar.gz -C apps/

可以直接启动

注:不可以在root用户下启动

4、在root用户下启动

启动命令:[hadoop@hadoop01 bin]$ ./elasticsearch

报错:

解决方式:

bin/elasticsearch -Des.insecure.allow.root=true

或者修改bin/elasticsearch ,加上ES_JAVA_OPTS属性:ES_JAVA_OPTS="-Des.insecure.allow.root=true"

这是出于系统安全的考虑设置条件,由于elasticsearch可以接受用户输入的脚本并且执行,为了系统安全考虑,建议创建一个单独的用户来运行Elasticsearch

注:可以直接在用户下进行安装

创建用户组和用户:

groupadd esgroup

useradd esuser -g esgroup -p espassword

更改elasticsearch文件夹及内部文件所属用户及组:

chown -R  esuser.esgroup elasticsearch-6.2.4

切换用户并运行:

su esuser

另外的错误:

5、后台运行命令:

./bin/elasticsearch -d

6、连接测试(默认端口是9200)

[hadoop@hadoop01 bin]$ curl 127.0.0.1:9200
{
  "name" : "ni0fmEP",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "Z-_tzfjUQ2e9jHNlzMYyLg",
  "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"
}

7、想要在外部访问需要修改elasticsearch.yml配置文件

路径:

/home/hadoop/apps/elasticsearch-6.2.4/config

重新启动elasticsearch

8、修改完IP之后启动的3个错误

ERROR: [4] bootstrap checks failed

[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

[2]: max number of threads [1024] for user [hadoop] is too low, increase to at least [4096]

[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

(1)处理第一个错误:

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

(2)处理第二个错误:

vi /etc/security/limits.d/90-nproc.conf
修改如下内容:
* soft nproc 1024

#修改为
* soft nproc 2048

(3)处理第三个错误

vi /etc/sysctl.conf
添加:
vm.max_map_count=655360
最后:sysctl -p 生效

重新启动elasticsearch

如果是在Centos6下启动的服务,可能会出现这个错误:

ERROR: bootstrap checks failed

system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

因为Centos6不支持SecComp,而ES5.2.1默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。

进入elasticsearch.yml目录下,找到这个注释,然后改成(如果没有,手动添加)

bootstrap.memory_lock: false
bootstrap.system_call_filter: false

如果得到下面的东西,就说明服务启动成功了

猜你喜欢

转载自blog.csdn.net/qq_41851454/article/details/81319758