`
yelinsen05
  • 浏览: 497827 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

Elasticsearch学习笔记之CentOS6.5搭建Elasticsearch6.2.2服务(Dean)

阅读更多
本文主要讲解 Elasticsearch6.2.2的安装过程。
Elasticsearch 是一个分布式、可扩展、实时的搜索与数据分析引擎。 它能从项目一开始就赋予你的数据以搜索、分析和探索的能力,可用于实现全文搜索和实时数据统计。
1.检查Java版本,目前版本 6.9 的可安装版需要Java 8
[ home]$ java -version
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-b10)
OpenJDK 64-Bit Server VM (build 25.171-b10, mixed mode)

2.安装ES
打开ES官网https://www.elastic.co/guide/en/elasticsearch/reference/current/install-elasticsearch.html

A-下载es
[root@  home]# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.2.tar.gz

B-解压tar
[root@ home]# tar -xzf elasticsearch-6.2.2.tar.gz
[root@ elasticsearch-6.2.2]# ls
bin  config  lib  LICENSE.txt  logs  modules  NOTICE.txt  plugins  README.textile

3.创建ES用户
默认ES 是不允许root用户运行的,所以我们需要创建新的用户。
[root@elasticsearch-6.2.2]# groupadd es
[root@elasticsearch-6.2.2]# useradd es -g es
[root@elasticsearch-6.2.2]# passwd es
更改用户 es 的密码 。
新的 密码:
无效的密码: 它基于字典单词
无效的密码: 过于简单
重新输入新的 密码:
passwd: 所有的身份验证令牌已经成功更新

4.修改ES文件的权限
[root@ elasticsearch-6.2.2]# cd ..
[root@ home]# ls
[root@ home]# chown -R es:es elasticsearch-6.2.2
[root@ home]# su es
[es@ home]$ cd elasticsearch-6.2.2

5.启动ES
 [es@ elasticsearch-6.2.2]$ ./bin/elasticsearch &
[1] 23167
[es@ elasticsearch-6.2.2]$ [2019-10-29T11:28:30,316][WARN ][o.e.b.JNANatives         ] unable to install syscall filter: 
java.lang.UnsupportedOperationException: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed
	at org.elasticsearch.bootstrap.SystemCallFilter.linuxImpl(SystemCallFilter.java:341) ~[elasticsearch-6.2.2.jar:6.2.2]
	at org.elasticsearch.bootstrap.SystemCallFilter.init(SystemCallFilter.java:616) ~[elasticsearch-6.2.2.jar:6.2.2]
	at org.elasticsearch.bootstrap.JNANatives.tryInstallSystemCallFilter(JNANatives.java:258) [elasticsearch-6.2.2.jar:6.2.2]
	at org.elasticsearch.bootstrap.Natives.tryInstallSystemCallFilter(Natives.java:113) [elasticsearch-6.2.2.jar:6.2.2]
	at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:110) [elasticsearch-6.2.2.jar:6.2.2]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:172) [elasticsearch-6.2.2.jar:6.2.2]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:323) [elasticsearch-6.2.2.jar:6.2.2]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) [elasticsearch-6.2.2.jar:6.2.2]
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:112) [elasticsearch-6.2.2.jar:6.2.2]
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) [elasticsearch-6.2.2.jar:6.2.2]
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) [elasticsearch-cli-6.2.2.jar:6.2.2]
	at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-cli-6.2.2.jar:6.2.2]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) [elasticsearch-6.2.2.jar:6.2.2]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:85) [elasticsearch-6.2.2.jar:6.2.2]
[2019-10-29T11:28:30,511][INFO ][o.e.n.Node               ] [] initializing ...
[2019-10-29T11:28:30,626][INFO ][o.e.e.NodeEnvironment    ] [zru1FRz] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [166.9gb], net total_space [196.7gb], types [rootfs]
[2019-10-29T11:28:30,626][INFO ][o.e.e.NodeEnvironment    ] [zru1FRz] heap size [1007.3mb], compressed ordinary object pointers [true]
[2019-10-29T11:28:30,628][INFO ][o.e.n.Node               ] node name [zru1FRz] derived from node ID [zru1FRz6R6GMKJkXYUYjPQ]; set [node.name] to override
[2019-10-29T11:28:30,628][INFO ][o.e.n.Node               ] version[6.2.2], pid[23167], build[10b1edd/2018-02-16T19:01:30.685723Z], OS[Linux/2.6.32-696.16.1.el6.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_171/25.171-b10]
[2019-10-29T11:28:30,628][INFO ][o.e.n.Node               ] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch.2rtu8FfL, -XX:+HeapDumpOnOutOfMemoryError, -XX:+PrintGCDetails, -XX:+PrintGCDateStamps, -XX:+PrintTenuringDistribution, -XX:+PrintGCApplicationStoppedTime, -Xloggc:logs/gc.log, -XX:+UseGCLogFileRotation, -XX:NumberOfGCLogFiles=32, -XX:GCLogFileSize=64m, -Des.path.home=/home/elasticsearch-6.2.2, -Des.path.conf=/home/elasticsearch-6.2.2/config]
[2019-10-29T11:28:31,527][INFO ][o.e.p.PluginsService     ] [zru1FRz] loaded module [aggs-matrix-stats]
[2019-10-29T11:28:31,527][INFO ][o.e.p.PluginsService     ] [zru1FRz] loaded module [analysis-common]
[2019-10-29T11:28:31,527][INFO ][o.e.p.PluginsService     ] [zru1FRz] loaded module [ingest-common]
[2019-10-29T11:28:31,527][INFO ][o.e.p.PluginsService     ] [zru1FRz] loaded module [lang-expression]
[2019-10-29T11:28:31,528][INFO ][o.e.p.PluginsService     ] [zru1FRz] loaded module [lang-mustache]
[2019-10-29T11:28:31,528][INFO ][o.e.p.PluginsService     ] [zru1FRz] loaded module [lang-painless]
[2019-10-29T11:28:31,528][INFO ][o.e.p.PluginsService     ] [zru1FRz] loaded module [mapper-extras]
[2019-10-29T11:28:31,528][INFO ][o.e.p.PluginsService     ] [zru1FRz] loaded module [parent-join]
[2019-10-29T11:28:31,529][INFO ][o.e.p.PluginsService     ] [zru1FRz] loaded module [percolator]
[2019-10-29T11:28:31,529][INFO ][o.e.p.PluginsService     ] [zru1FRz] loaded module [rank-eval]
[2019-10-29T11:28:31,529][INFO ][o.e.p.PluginsService     ] [zru1FRz] loaded module [reindex]
[2019-10-29T11:28:31,529][INFO ][o.e.p.PluginsService     ] [zru1FRz] loaded module [repository-url]
[2019-10-29T11:28:31,529][INFO ][o.e.p.PluginsService     ] [zru1FRz] loaded module [transport-netty4]
[2019-10-29T11:28:31,529][INFO ][o.e.p.PluginsService     ] [zru1FRz] loaded module [tribe]
[2019-10-29T11:28:31,530][INFO ][o.e.p.PluginsService     ] [zru1FRz] no plugins loaded
[2019-10-29T11:28:34,567][INFO ][o.e.d.DiscoveryModule    ] [zru1FRz] using discovery type [zen]
[2019-10-29T11:28:35,174][INFO ][o.e.n.Node               ] initialized
[2019-10-29T11:28:35,174][INFO ][o.e.n.Node               ] [zru1FRz] starting ...
[2019-10-29T11:28:35,347][INFO ][o.e.t.TransportService   ] [zru1FRz] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}
[2019-10-29T11:28:35,366][WARN ][o.e.b.BootstrapChecks    ] [zru1FRz] max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
[2019-10-29T11:28:35,367][WARN ][o.e.b.BootstrapChecks    ] [zru1FRz] max number of threads [1024] for user [es] is too low, increase to at least [4096]
[2019-10-29T11:28:35,367][WARN ][o.e.b.BootstrapChecks    ] [zru1FRz] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2019-10-29T11:28:35,367][WARN ][o.e.b.BootstrapChecks    ] [zru1FRz] system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
[2019-10-29T11:28:38,445][INFO ][o.e.c.s.MasterService    ] [zru1FRz] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {zru1FRz}{zru1FRz6R6GMKJkXYUYjPQ}{W_tsMsdfRMSszUPdBQQGHw}{127.0.0.1}{127.0.0.1:9300}
[2019-10-29T11:28:38,452][INFO ][o.e.c.s.ClusterApplierService] [zru1FRz] new_master {zru1FRz}{zru1FRz6R6GMKJkXYUYjPQ}{W_tsMsdfRMSszUPdBQQGHw}{127.0.0.1}{127.0.0.1:9300}, reason: apply cluster state (from master [master {zru1FRz}{zru1FRz6R6GMKJkXYUYjPQ}{W_tsMsdfRMSszUPdBQQGHw}{127.0.0.1}{127.0.0.1:9300} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
[2019-10-29T11:28:38,500][INFO ][o.e.h.n.Netty4HttpServerTransport] [zru1FRz] publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}
[2019-10-29T11:28:38,501][INFO ][o.e.n.Node               ] [zru1FRz] started
[2019-10-29T11:28:38,509][INFO ][o.e.g.GatewayService     ] [zru1FRz] recovered [0] indices into cluster_state

验证一下服务是否正常
[es@ elasticsearch-6.2.2]$ curl -i "http://localhost:9200"
HTTP/1.1 200 OK
content-type: application/json; charset=UTF-8
content-length: 435

{
  "name" : "zru1FRz",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "I4jRESDLSnKgGzfw845C6w",
  "version" : {
    "number" : "6.2.2",
    "build_hash" : "10b1edd",
    "build_date" : "2018-02-16T19:01:30.685723Z",
    "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"
}

6.外网访问权限
此时ES还是内网可访问,外网访问需要修改配置文件elasticsearch.yml
[es@  elasticsearch-6.2.2]$ curl -i "http://xx.xx.xx.xx:9200"
curl: (7) couldn't connect to host

7.先杀死ES进程
[es@ elasticsearch-6.2.2]$ ps -ef | grep elastic
[es@ elasticsearch-6.2.2]$ kill -9 23616

8.修改配置文件elasticsearch.yml
[es@ elasticsearch-6.2.2]$ vim config/elasticsearch.yml
network.host: 0.0.0.0  #主机地址,这里写本机IP
http.port: 9200 #端口

9.重新运行ES会报错
[2019-10-29T12:46:29,281][INFO ][o.e.n.Node               ] initialized
[2019-10-29T12:46:29,281][INFO ][o.e.n.Node               ] [zru1FRz] starting ...
[2019-10-29T12:46:29,453][INFO ][o.e.t.TransportService   ] [zru1FRz] publish_address {127.0.0.1:9300}, bound_addresses {0.0.0.0:9300}
[2019-10-29T12:46:29,464][INFO ][o.e.b.BootstrapChecks    ] [zru1FRz] bound or publishing to a non-loopback address, enforcing bootstrap checks
ERROR: [4] bootstrap checks failed
[1]: max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
[2]: max number of threads [1024] for user [es] 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]
[4]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
[2019-10-29T12:46:29,474][INFO ][o.e.n.Node               ] [zru1FRz] stopping ...
[2019-10-29T12:46:29,512][INFO ][o.e.n.Node               ] [zru1FRz] stopped
[2019-10-29T12:46:29,513][INFO ][o.e.n.Node               ] [zru1FRz] closing ...
[2019-10-29T12:46:29,529][INFO ][o.e.n.Node               ] [zru1FRz] closed

按照错误提示信息改上面描述的四点就行,注意要用ROOT身份修改配置文件,执行。
1.[1]: max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
修改
编辑 /etc/security/limits.conf,追加以下内容;
* soft nofile 65536
* hard nofile 65536
此文件修改后需要重新登录用户,才会生效
[root@  home]# sudo vim /etc/security/limits.conf
最后面加上
* soft nofile 65536
* hard nofile 65536

2.[2]: max number of threads [1024] for user [es] is too low, increase to at least [4096]
vim /etc/security/limits.d/90-nproc.conf 
soft nproc 2048

我的是1024全部改成4096
3.[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[root@ home]# sudo vim /etc/sysctl.conf 
编辑 /etc/sysctl.conf,追加以下内容:
vm.max_map_count=655360
保存后,执行:
sysctl -p
重新启动,成功。

4.[4]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
Centos6不支持SecComp,而ES6.2.0默认bootstrap.system_call_filter为true
禁用:在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
[es@ elasticsearch-6.2.2]$ vim config/elasticsearch.yml 
bootstrap.memory_lock: false 
bootstrap.system_call_filter: false


10.修改完重启ES即可
[es@ elasticsearch-6.2.2]$ ./bin/elasticsearch &

测试IP访问:
[es@iZbp10nfd0w1yzy8wzol8bZ elasticsearch-6.2.2]$ curl -i "http://xx.xx.xx.xx:9200"
HTTP/1.1 200 OK
content-type: application/json; charset=UTF-8
content-length: 435

{
  "name" : "zru1FRz",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "I4jRESDLSnKgGzfw845C6w",
  "version" : {
    "number" : "6.2.2",
    "build_hash" : "10b1edd",
    "build_date" : "2018-02-16T19:01:30.685723Z",
    "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"
}


11.安装中文分词插件,直接下载解压到plugins文件夹下,注意解压完吧压缩包删掉
[es@iZbp10nfd0w1yzy8wzol8bZ elasticsearch-6.2.2]$ cd plugins/
[es@iZbp10nfd0w1yzy8wzol8bZ plugins]$ wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.2.2/elasticsearch-analysis-ik-6.2.2.zip
[es@  plugins]$ unzip elasticsearch-analysis-ik-6.2.2.zip
[es@iZbp10nfd0w1yzy8wzol8bZ plugins]$ rm -r elasticsearch-analysis-ik-6.2.2.zip

最后记得重启ES

分享到:
评论

相关推荐

    elasticsearch elasticsearch-6.2.2 elasticsearch-6.2.2.zip 下载

    根据提供的文件信息,我们可以推断出本篇文章将围绕Elasticsearch 6.2.2版本进行详细介绍,包括其下载方式、主要功能特性以及在实际应用中的常见用途。 ### Elasticsearch简介 Elasticsearch是一款基于Lucene的...

    CentOS 7 部署 Elasticsearch7.4 集群并进行安全认证.docx

    CentOS 7 部署 Elasticsearch 7.4 集群并进行安全认证 Elasticsearch 是一个基于 Lucene 库的搜索和数据分析引擎,它提供了一个分布式的搜索引擎,可以对大规模数据进行搜索、分析和可视化。在本文中,我们将了解...

    elasticsearch1.6.0的安装和基本使用(cent6.5安装)

    Elasticsearch 1.6.0 的安装和基本使用(CentOS 6.5 安装) Elasticsearch 是一个基于 Lucene 的搜索引擎,提供了一个分布式的、可扩展的搜索引擎解决方案。下面是 Elasticsearch 1.6.0 的安装和基本使用步骤。 1....

    CentOS 7 elasticsearch service 开机自启.docx

    CentOS 7 Elasticsearch 服务开机自启配置 CentOS 7 操作系统中,Elasticsearch 服务默认不能以 root 用户身份启动,因此需要创建一个新的用户来启动 Elasticsearch 服务。下面将详细介绍如何配置 Elasticsearch ...

    CentOS7下搭建多节点Elasticsearch集群.docx

    CentOS7 是一个流行的 Linux 发行版,搭建多节点 Elasticsearch 集群可以提供高可用性和高性能的搜索服务。下面是 CentOS7 下搭建多节点 Elasticsearch 集群的详细步骤和知识点。 知识点 1:Elasticsearch 集群...

    elasticsearch-6.2.2.msi

    Elasticsearch最新版是一个高度可扩展的开源全文搜索和分析引擎,它允许您快速、实时地存储、搜索和分析大量数据,它通常用作为具有复杂的搜索功能。

    elasticsearch6.2.2安装包及ik分词器插件、ingest-attachment插件。

    elasticsearch6.2.2安装包及ik分词器插件、ingest-attachment插件。博客地址【https://blog.csdn.net/qq_29914837/article/details/102373152】

    esxi6.5环境下centos6.5+ambari+HDP+ELK+neo4j集群搭建

    各产品软件版本 centos 6.5 esxi 6.5 SSH 5.3 JDK 1.8_131 MAVEN 3.6 ...基于EXSI6.5环境下centos6系统搭建ambari+HDP+elasticsearch+kibana+logstash+neo4j集群搭建教程,教程共54页,10000+以上字数

    (狂神)ElasticSearch快速入门笔记,ElasticSearch基本操作以及爬虫(Java-ES仿京东实战)

    (狂神)ElasticSearch快速入门笔记,ElasticSearch基本操作以及爬虫(Java-ES仿京东实战),包含了小狂神讲的东西,特别适合新手学习,笔记保存下来可以多看看。好记性不如烂笔头哦~,ElasticSearch,简称es,es是一个...

    elasticsearch-6.2.2

    elasticsearch-6.2.2

    elasticsearch-analysis-ik-6.2.2.zip

    《Elasticsearch Analysis IK插件6.2.2深度解析》 Elasticsearch Analysis IK插件,全称为“elasticsearch-analysis-ik”,是为Elasticsearch设计的一款强大的中文分词插件。在版本6.2.2中,该插件为用户提供了更...

    elasticsearch6.2.2安装包及ik分词器插件、ingest-attachment插件.rar

    elasticsearch6.2.2安装包及ik分词器插件、ingest-attachment插件。博客地址【https://blog.csdn.net/qq_29914837/article/details/102373152】

    ElasticSearch学习笔记

    ElasticSearch学习笔记 ElasticSearch是基于Apache Lucene的搜索和数据分析引擎,提供了RESTful API用于数据的索引、搜索和分析。本笔记将对ElasticSearch的基本概念、架构、应用场景和实现细节进行详细介绍。 一...

    elasticsearch xpack6.2.2 破解包

    下载xpack6.2.2.zip文件,将x-pack-core-6.2.2.jar 文件放置在elasticsearch的安装目录下的elasticsearch-6.2.2\plugins\x-pack\x-pack-core 下替换原来的x-pack-core-6.2.2.jar文件。 然后 参考 ...

    elasticsearch-6.2.2.rar

    Elasticsearch 6.2.2 是一个高度可扩展的开源全文搜索引擎,它以其强大的分布式特性,实时性,以及在大数据量下的优秀性能而闻名。这个版本的压缩包"elasticsearch-6.2.2.rar"包含了运行和管理Elasticsearch所需的...

    elasticsearch-6.2.2+kibana-6.2.2.rar

    Elasticsearch 6.2.2 和 Kibana 6.2.2 是一套流行的开源搜索引擎和数据分析工具,常用于日志分析、实时监控和大数据可视化。这两个组件都是 Elastic Stack(以前称为 ELK Stack,包括 Elasticsearch、Logstash、...

Global site tag (gtag.js) - Google Analytics