分享

ElasticSearch 6 安装、下载

 好好学戏 2019-08-28

1,安装配置JDK 8

参考:官方文档

#为什么是JDK1.8?在ElasticSearch6.2.4中提到:JDK版本必须为:1.8.0_131 以上

> 1,安装JDK1.8-161

  1. #解压tar.gz

  2. tar -zxvf jdk-8u161-linux-x64.tar.gz

> 2,配置环境变量

  1. vim /etc/profile.d/dev.sh

  2. # Set Dev Path

  3. JAVA_HOME=/usr/local/java/jdk1.8.0_161/

  4. export JAVA_HOME


  5. export PATH=$PATH:$JAVA_HOME/bin

  1. #生效变量

  2. source /etc/profile.d/dev.sh

  1. [root@ gameServer local] java -version

  2. java version "1.8.0_161"

  3. Java(TM) SE Runtime Environment (build 1.8.0_161-b12)

  4. Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

2,增加用户(ElasticSearch不允许Root启动)

Root启动异常为:can not run elasticsearch as root 

  1. [root@gameServer local] #adduser payment

  2. [root@gameServer local]#passwd payment

  3. Changing password for user payment.

  4. New password:

  5. BAD PASSWORD: The password is shorter than 8 characters

  6. Retype new password:

  7. passwd: all authentication tokens updated successfully.

3,下载ElasticSearch

  1. [payment@gameServer ~]$ cd elasticSearch/

  2. [payment@gameServer elasticSearch]$ wget https://artifacts./downloads/elasticsearch/elasticsearch-6.2.4.tar.gz

  3. --2018-06-05 21:14:44-- https://artifacts./downloads/elasticsearch/elasticsearch-6.2.4.tar.gz

  4. 正在解析主机 artifacts.... 54.235.171.120, 54.235.82.130, 23.21.67.46, ...

  5. 正在连接 artifacts.|54.235.171.120|:443... 已连接。

  6. 已发出 HTTP 请求,正在等待回应... 200 OK

  7. 长度:29056810 (28M) [binary/octet-stream]

  8. 正在保存至: “elasticsearch-6.2.4.tar.gz”


  9. 100%[========================================================================================>] 29,056,810 387K/s in 93s


  10. 2018-06-05 21:16:19 (304 KB/s) - 已保存 “elasticsearch-6.2.4.tar.gz” [29056810/29056810])


  11. [payment@gameServer elasticSearch]$ tar -zxvf elasticsearch-6.2.4.tar.gz

  12. [payment@gameServer elasticSearch]$ cd elasticsearch-6.2.4

4,配置ElasticSearch和Linux 

  1. [payment@gameServer elasticsearch-6.2.4]$ vim config/elasticsearch.yml

  2. # Set the bind address to a specific IP (IPv4 or IPv6):

  3. #

  4. network.host: 172.17.63.15

  5. #

  6. # Set a custom port for HTTP:

  7. #

  8. http.port: 9200

5、 启动ElasticSearch

eg:如果报错不要慌张、随后有解决方案

    1>、控制台启动:

  1. [payment@gameServer elasticsearch-6.2.4]$ ./bin/elasticsearch

  2. [2018-06-06T10:29:18,432][INFO ][o.e.n.Node ] [] initializing ...

  3. [2018-06-06T10:29:18,614][INFO ][o.e.e.NodeEnvironment ] [SdEluaQ] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [402.8gb], net total_space [442.7gb], types [rootfs]

  4. [2018-06-06T10:29:18,614][INFO ][o.e.e.NodeEnvironment ] [SdEluaQ] heap size [990.7mb], compressed ordinary object pointers [true]

  5. [2018-06-06T10:29:18,616][INFO ][o.e.n.Node ] node name [SdEluaQ] derived from node ID [SdEluaQkTfi1p-yRtlxHSA]; set [node.name] to override

  6. [2018-06-06T10:29:18,616][INFO ][o.e.n.Node ] version[6.2.4], pid[26954], build[ccec39f/2018-04-12T20:37:28.497551Z], OS[Linux/2.6.32-696.28.1.el6.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_161/25.161-b12]

  7. [2018-06-06T10:29:18,616][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.lVPlg9Y5, -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/payment/elasticSearch/elasticsearch-6.2.4, -Des.path.conf=/home/payment/elasticSearch/elasticsearch-6.2.4/config]

  8. [2018-06-06T10:29:19,137][INFO ][o.e.p.PluginsService ] [SdEluaQ] loaded module [aggs-matrix-stats]

  9. [2018-06-06T10:29:19,137][INFO ][o.e.p.PluginsService ] [SdEluaQ] loaded module [analysis-common]

  10. [2018-06-06T10:29:19,137][INFO ][o.e.p.PluginsService ] [SdEluaQ] loaded module [ingest-common]

  11. [2018-06-06T10:29:19,137][INFO ][o.e.p.PluginsService ] [SdEluaQ] loaded module [lang-]

  12. [2018-06-06T10:29:19,137][INFO ][o.e.p.PluginsService ] [SdEluaQ] loaded module [lang-mustache]

  13. [2018-06-06T10:29:19,137][INFO ][o.e.p.PluginsService ] [SdEluaQ] loaded module [lang-painless]

  14. [2018-06-06T10:29:19,137][INFO ][o.e.p.PluginsService ] [SdEluaQ] loaded module [mapper-extras]

  15. [2018-06-06T10:29:19,138][INFO ][o.e.p.PluginsService ] [SdEluaQ] loaded module [parent-join]

  16. [2018-06-06T10:29:19,138][INFO ][o.e.p.PluginsService ] [SdEluaQ] loaded module [percolator]

  17. [2018-06-06T10:29:19,138][INFO ][o.e.p.PluginsService ] [SdEluaQ] loaded module [rank-eval]

  18. [2018-06-06T10:29:19,138][INFO ][o.e.p.PluginsService ] [SdEluaQ] loaded module [reindex]

  19. [2018-06-06T10:29:19,138][INFO ][o.e.p.PluginsService ] [SdEluaQ] loaded module [repository-url]

  20. [2018-06-06T10:29:19,138][INFO ][o.e.p.PluginsService ] [SdEluaQ] loaded module [transport-netty4]

  21. [2018-06-06T10:29:19,138][INFO ][o.e.p.PluginsService ] [SdEluaQ] loaded module [tribe]

  22. [2018-06-06T10:29:19,139][INFO ][o.e.p.PluginsService ] [SdEluaQ] no plugins loaded

  23. [2018-06-06T10:29:21,350][INFO ][o.e.d.DiscoveryModule ] [SdEluaQ] using discovery type [zen]

  24. [2018-06-06T10:29:21,752][INFO ][o.e.n.Node ] initialized

  25. [2018-06-06T10:29:21,752][INFO ][o.e.n.Node ] [SdEluaQ] starting ...

  26. [2018-06-06T10:29:21,845][INFO ][o.e.t.TransportService ] [SdEluaQ] publish_address {172.17.63.15:9300}, bound_addresses {172.17.63.15:9300}

  27. [2018-06-06T10:29:21,851][INFO ][o.e.b.BootstrapChecks ] [SdEluaQ] bound or publishing to a non-loopback address, enforcing bootstrap checks

  28. [2018-06-06T10:29:24,903][INFO ][o.e.c.s.MasterService ] [SdEluaQ] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {SdEluaQ}{SdEluaQkTfi1p-yRtlxHSA}{e6G8iUkmRNerO3aI9nqZnA}{172.17.63.15}{172.17.63.15:9300}

  29. [2018-06-06T10:29:24,907][INFO ][o.e.c.s.ClusterApplierService] [SdEluaQ] new_master {SdEluaQ}{SdEluaQkTfi1p-yRtlxHSA}{e6G8iUkmRNerO3aI9nqZnA}{172.17.63.15}{172.17.63.15:9300}, reason: apply cluster state (from master [master {SdEluaQ}{SdEluaQkTfi1p-yRtlxHSA}{e6G8iUkmRNerO3aI9nqZnA}{172.17.63.15}{172.17.63.15:9300} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])

  30. [2018-06-06T10:29:24,921][INFO ][o.e.h.n.Netty4HttpServerTransport] [SdEluaQ] publish_address {172.17.63.15:9200}, bound_addresses {172.17.63.15:9200}

  31. [2018-06-06T10:29:24,921][INFO ][o.e.n.Node ] [SdEluaQ] started

  32. [2018-06-06T10:29:25,048][INFO ][o.e.g.GatewayService ] [SdEluaQ] recovered [0] indices into cluster_state

2、控制台启动下:停止(Ctrl+C)

  1. ^C[2018-06-06T10:49:13,825][INFO ][o.e.n.Node ] [SdEluaQ] stopping ...

  2. [2018-06-06T10:49:13,864][INFO ][o.e.n.Node ] [SdEluaQ] stopped

  3. [2018-06-06T10:49:13,865][INFO ][o.e.n.Node ] [SdEluaQ] closing ...

  4. [2018-06-06T10:49:13,876][INFO ][o.e.n.Node ] [SdEluaQ] closed

  5. [payment@gameServer elasticsearch-6.2.4]$

3、后台启动

  1. [payment@gameServer elasticsearch-6.2.4]$ ./bin/elasticsearch -d

  2. [payment@gameServer elasticsearch-6.2.4]$

4、验证

  1. [payment@gameServer elasticsearch-6.2.4]$ curl "http://172.17.63.15:9200"

  2. {

  3. "name" : "SdEluaQ",

  4. "cluster_name" : "elasticsearch",

  5. "cluster_uuid" : "Oz0crt7uRTeVgPX0EFZ3Kg",

  6. "version" : {

  7. "number" : "6.2.4",

  8. "build_hash" : "ccec39f",

  9. "build_date" : "2018-04-12T20:37:28.497551Z",

  10. "build_snapshot" : false,

  11. "lucene_version" : "7.2.1",

  12. "minimum_wire_compatibility_version" : "5.6.0",

  13. "minimum_index_compatibility_version" : "5.0.0"

  14. },

  15. "tagline" : "You Know, for Search"

  16. }

本机浏览器中:

如果访问不通:请确保能ping通 es配置的IP

6、安装相关问题汇总:

    1>、Centos6 安装启动失败:

  1. ERROR: [1] bootstrap checks failed

  2. [1]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

        解决方案 参考文档

  1. [payment@gameServer elasticsearch-6.2.4]$ vim config/elasticsearch.yml

  2. # ----------------------------------- Memory -----------------------------------

  3. #

  4. # Lock the memory on startup:

  5. #

  6. bootstrap.memory_lock: false

  7. bootstrap.system_call_filter: false

  8. #

  9. # Make sure that the heap size is set to about half the memory available

  10. # on the system and that the owner of the process is allowed to use this

  11. # limit.

  12. #

  13. # Elasticsearch performs poorly when the system is swapping the memory.

    2>、ERROR: bootstrap checks failed

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

  2. max number of threads [1024] for user [lishang] likely too low, increase to at least [2048]

解决方案:Root用户修改

  1. vim /etc/security/limits.conf

  2. 添加如下内容:

  3. * soft nofile 65536

  4. * hard nofile 131072

  5. * soft nproc 2048

  6. * hard nproc 4096

    3>、max number of threads [1024] for user [lish] likely too low, increase to at least [4096]

  解决方案:Root用户修改

  1. vim /etc/security/limits.d/90-nproc.conf

  2. * soft nproc 4096

  3. root soft nproc unlimited

    4>,最大虚拟内存区域vm.max_map_count [65530]可能太低,增加到至少[262144]

解决方案:根用户修改

  1. vim /etc/sysctl.conf

  2. #添加如下配置并保存

  3. vm.max_map_count = 655360

  1. [root @ gameServer〜]#sysctl -p

  2. net.ipv4.ip_forward = 0

  3. net.ipv4.conf.default.rp_filter = 1

  4. net.ipv4.conf.default.accept_source_route = 0

  5. kernel.sysrq = 0

  6. kernel.core_uses_pid = 1

  7. net.ipv4.tcp_syncookies = 1

  8. kernel.msgmnb = 65536

  9. kernel.msgmax = 65536

  10. kernel.shmmax = 68719476736

  11. kernel.shmall = 4294967296

  12. vm.max_map_count = 655360


    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多