Elastic Stack之ElasticSearch分布式集群二进制方式部署
Elastic Stack之ElasticSearch分布式集群二进制方式部署
作者:尹正杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。
想必大家都知道ELK其实就是Elasticsearch+Logstash+Kibanna。其中的Logstash由于收集日志很占用资源,官方引入了一个新的组建叫做Beats。它以后可能会渠道Logstash,因为Beats是比Logstash更轻量级的日志收集工具。于此同时,该公司还引入了X-pack插件(需要单独安装),可以在安全审计,权限控制,机器学习,实时监控,数据导出(用于离线分享,支持PDF,CSV等格式)以及图形分析等功能。当然,如果可以的话,你可以使用Elastic Cloud公有云的或者自建Elastic Cloud Enterpriose私有云版本。因此ELK是一个比较古老的名字,该公司将ELK更名为“Elastic Stack”。
一.官方网址介绍
1>.Elasticsearch官方地址(https://www.elastic.co/cn/)
2>.下载Elstic公司的相关产品(https://www.elastic.co/cn/downloads)
二.下载相应的软件
1>.下载Elasticsearch(下载地址:https://www.elastic.co/downloads/elasticsearch)
2>.下载Kibana(下载地址:https://www.elastic.co/downloads/kibana)
3>.下载X-Pack软件
默认情况下,安装Elasticsearch时会安装X-Pack。官方介绍了通过命令行安装X-Pack插件,地址链接:https://www.elastic.co/downloads/x-pack。
我们从上图可以看出,X-Pack的版本是6.2.4版本对吧,如果你非要拿到X-pack这个软件包的话,官方也提供了相应的链接地址:https://www.elastic.co/guide/en/elasticsearch/reference/6.2/installing-xpack-es.html。如下图所示:
三.安装ElasticSearch
1>.安装JDK
我们知道ES是使用java语言编写的,因此我们需要安装对应的jdk。推荐安装jdk1.8及以上版本(1.7版本官方以及不支持维护了,推荐使用openjdk,官方版本的jdk是收费的!)安装步骤可以参考我之前部署jdk版本的方式:https://www.cnblogs.com/yinzhengjie/p/10226567.html。
[root@node101 bin]# yum -y install java-1.8.0-openjdk.x86_64 Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.tuna.tsinghua.edu.cn * updates: mirrors.tuna.tsinghua.edu.cn Resolving Dependencies --> Running transaction check ---> Package java-1.8.0-openjdk.x86_64 1:1.8.0.191.b12-1.el7_6 will be installed --> Processing Dependency: java-1.8.0-openjdk-headless(x86-64) = 1:1.8.0.191.b12-1.el7_6 for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: xorg-x11-fonts-Type1 for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: libpng15.so.15(PNG15_0)(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: libjvm.so(SUNWprivate_1.1)(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: libjpeg.so.62(LIBJPEG_6.2)(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: libjava.so(SUNWprivate_1.1)(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: fontconfig(x86-64) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: libpng15.so.15()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: libjvm.so()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: libjpeg.so.62()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: libjava.so()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: libgif.so.4()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: libXtst.so.6()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: libXrender.so.1()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: libXi.so.6()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: libXext.so.6()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: libXcomposite.so.1()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: libX11.so.6()(64bit) for package: 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64 --> Running transaction check ---> Package fontconfig.x86_64 0:2.13.0-4.3.el7 will be installed --> Processing Dependency: freetype >= 2.8-7 for package: fontconfig-2.13.0-4.3.el7.x86_64 --> Processing Dependency: fontpackages-filesystem for package: fontconfig-2.13.0-4.3.el7.x86_64 --> Processing Dependency: dejavu-sans-fonts for package: fontconfig-2.13.0-4.3.el7.x86_64 ---> Package giflib.x86_64 0:4.1.6-9.el7 will be installed --> Processing Dependency: libSM.so.6()(64bit) for package: giflib-4.1.6-9.el7.x86_64 --> Processing Dependency: libICE.so.6()(64bit) for package: giflib-4.1.6-9.el7.x86_64 ---> Package java-1.8.0-openjdk-headless.x86_64 1:1.8.0.191.b12-1.el7_6 will be installed --> Processing Dependency: tzdata-java >= 2015d for package: 1:java-1.8.0-openjdk-headless-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: nss-softokn(x86-64) >= 3.36.0 for package: 1:java-1.8.0-openjdk-headless-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: nss(x86-64) >= 3.36.0 for package: 1:java-1.8.0-openjdk-headless-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: copy-jdk-configs >= 2.2 for package: 1:java-1.8.0-openjdk-headless-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: chkconfig >= 1.7 for package: 1:java-1.8.0-openjdk-headless-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: chkconfig >= 1.7 for package: 1:java-1.8.0-openjdk-headless-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: lksctp-tools(x86-64) for package: 1:java-1.8.0-openjdk-headless-1.8.0.191.b12-1.el7_6.x86_64 --> Processing Dependency: jpackage-utils for package: 1:java-1.8.0-openjdk-headless-1.8.0.191.b12-1.el7_6.x86_64 ---> Package libX11.x86_64 0:1.6.5-2.el7 will be installed --> Processing Dependency: libX11-common >= 1.6.5-2.el7 for package: libX11-1.6.5-2.el7.x86_64 --> Processing Dependency: libxcb.so.1()(64bit) for package: libX11-1.6.5-2.el7.x86_64 ---> Package libXcomposite.x86_64 0:0.4.4-4.1.el7 will be installed ---> Package libXext.x86_64 0:1.3.3-3.el7 will be installed ---> Package libXi.x86_64 0:1.7.9-1.el7 will be installed ---> Package libXrender.x86_64 0:0.9.10-1.el7 will be installed ---> Package libXtst.x86_64 0:1.2.3-1.el7 will be installed ---> Package libjpeg-turbo.x86_64 0:1.2.90-6.el7 will be installed ---> Package libpng.x86_64 2:1.5.13-7.el7_2 will be installed ---> Package xorg-x11-fonts-Type1.noarch 0:7.5-9.el7 will be installed --> Processing Dependency: ttmkfdir for package: xorg-x11-fonts-Type1-7.5-9.el7.noarch --> Processing Dependency: ttmkfdir for package: xorg-x11-fonts-Type1-7.5-9.el7.noarch --> Processing Dependency: mkfontdir for package: xorg-x11-fonts-Type1-7.5-9.el7.noarch --> Processing Dependency: mkfontdir for package: xorg-x11-fonts-Type1-7.5-9.el7.noarch --> Running transaction check ---> Package chkconfig.x86_64 0:1.3.61-5.el7 will be updated ---> Package chkconfig.x86_64 0:1.7.4-1.el7 will be an update ---> Package copy-jdk-configs.noarch 0:3.3-10.el7_5 will be installed ---> Package dejavu-sans-fonts.noarch 0:2.33-6.el7 will be installed --> Processing Dependency: dejavu-fonts-common = 2.33-6.el7 for package: dejavu-sans-fonts-2.33-6.el7.noarch ---> Package fontpackages-filesystem.noarch 0:1.44-8.el7 will be installed ---> Package freetype.x86_64 0:2.4.11-11.el7 will be updated ---> Package freetype.x86_64 0:2.8-12.el7 will be an update ---> Package javapackages-tools.noarch 0:3.4.1-11.el7 will be installed --> Processing Dependency: python-javapackages = 3.4.1-11.el7 for package: javapackages-tools-3.4.1-11.el7.noarch --> Processing Dependency: libxslt for package: javapackages-tools-3.4.1-11.el7.noarch ---> Package libICE.x86_64 0:1.0.9-9.el7 will be installed ---> Package libSM.x86_64 0:1.2.2-2.el7 will be installed ---> Package libX11-common.noarch 0:1.6.5-2.el7 will be installed ---> Package libxcb.x86_64 0:1.13-1.el7 will be installed --> Processing Dependency: libXau.so.6()(64bit) for package: libxcb-1.13-1.el7.x86_64 ---> Package lksctp-tools.x86_64 0:1.0.17-2.el7 will be installed ---> Package nss.x86_64 0:3.19.1-18.el7 will be updated --> Processing Dependency: nss = 3.19.1-18.el7 for package: nss-sysinit-3.19.1-18.el7.x86_64 --> Processing Dependency: nss(x86-64) = 3.19.1-18.el7 for package: nss-tools-3.19.1-18.el7.x86_64 ---> Package nss.x86_64 0:3.36.0-7.el7_5 will be an update --> Processing Dependency: nss-util >= 3.36.0-1 for package: nss-3.36.0-7.el7_5.x86_64 --> Processing Dependency: nspr >= 4.19.0 for package: nss-3.36.0-7.el7_5.x86_64 --> Processing Dependency: nss-pem(x86-64) for package: nss-3.36.0-7.el7_5.x86_64 --> Processing Dependency: libnssutil3.so(NSSUTIL_3.31)(64bit) for package: nss-3.36.0-7.el7_5.x86_64 --> Processing Dependency: libnssutil3.so(NSSUTIL_3.24)(64bit) for package: nss-3.36.0-7.el7_5.x86_64 --> Processing Dependency: libnssutil3.so(NSSUTIL_3.21)(64bit) for package: nss-3.36.0-7.el7_5.x86_64 ---> Package nss-softokn.x86_64 0:3.16.2.3-13.el7_1 will be updated ---> Package nss-softokn.x86_64 0:3.36.0-5.el7_5 will be an update --> Processing Dependency: nss-softokn-freebl(x86-64) >= 3.36.0-5.el7_5 for package: nss-softokn-3.36.0-5.el7_5.x86_64 ---> Package ttmkfdir.x86_64 0:3.0.9-42.el7 will be installed ---> Package tzdata-java.noarch 0:2018i-1.el7 will be installed ---> Package xorg-x11-font-utils.x86_64 1:7.5-21.el7 will be installed --> Processing Dependency: libfontenc.so.1()(64bit) for package: 1:xorg-x11-font-utils-7.5-21.el7.x86_64 --> Running transaction check ---> Package dejavu-fonts-common.noarch 0:2.33-6.el7 will be installed ---> Package libXau.x86_64 0:1.0.8-2.1.el7 will be installed ---> Package libfontenc.x86_64 0:1.1.3-3.el7 will be installed ---> Package libxslt.x86_64 0:1.1.28-5.el7 will be installed ---> Package nspr.x86_64 0:4.10.8-2.el7_1 will be updated ---> Package nspr.x86_64 0:4.19.0-1.el7_5 will be an update ---> Package nss-pem.x86_64 0:1.0.3-5.el7 will be installed ---> Package nss-softokn-freebl.x86_64 0:3.16.2.3-13.el7_1 will be updated ---> Package nss-softokn-freebl.x86_64 0:3.36.0-5.el7_5 will be an update ---> Package nss-sysinit.x86_64 0:3.19.1-18.el7 will be updated ---> Package nss-sysinit.x86_64 0:3.36.0-7.el7_5 will be an update ---> Package nss-tools.x86_64 0:3.19.1-18.el7 will be updated ---> Package nss-tools.x86_64 0:3.36.0-7.el7_5 will be an update ---> Package nss-util.x86_64 0:3.19.1-4.el7_1 will be updated ---> Package nss-util.x86_64 0:3.36.0-1.el7_5 will be an update ---> Package python-javapackages.noarch 0:3.4.1-11.el7 will be installed --> Processing Dependency: python-lxml for package: python-javapackages-3.4.1-11.el7.noarch --> Running transaction check ---> Package python-lxml.x86_64 0:3.2.1-4.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================= Package Arch Version Repository Size ============================================================================================================================================================================= Installing: java-1.8.0-openjdk x86_64 1:1.8.0.191.b12-1.el7_6 updates 254 k Installing for dependencies: copy-jdk-configs noarch 3.3-10.el7_5 base 21 k dejavu-fonts-common noarch 2.33-6.el7 base 64 k dejavu-sans-fonts noarch 2.33-6.el7 base 1.4 M fontconfig x86_64 2.13.0-4.3.el7 base 254 k fontpackages-filesystem noarch 1.44-8.el7 base 9.9 k giflib x86_64 4.1.6-9.el7 base 40 k java-1.8.0-openjdk-headless x86_64 1:1.8.0.191.b12-1.el7_6 updates 32 M javapackages-tools noarch 3.4.1-11.el7 base 73 k libICE x86_64 1.0.9-9.el7 base 66 k libSM x86_64 1.2.2-2.el7 base 39 k libX11 x86_64 1.6.5-2.el7 base 606 k libX11-common noarch 1.6.5-2.el7 base 164 k libXau x86_64 1.0.8-2.1.el7 base 29 k libXcomposite x86_64 0.4.4-4.1.el7 base 22 k libXext x86_64 1.3.3-3.el7 base 39 k libXi x86_64 1.7.9-1.el7 base 40 k libXrender x86_64 0.9.10-1.el7 base 26 k libXtst x86_64 1.2.3-1.el7 base 20 k libfontenc x86_64 1.1.3-3.el7 base 31 k libjpeg-turbo x86_64 1.2.90-6.el7 base 134 k libpng x86_64 2:1.5.13-7.el7_2 base 213 k libxcb x86_64 1.13-1.el7 base 214 k libxslt x86_64 1.1.28-5.el7 base 242 k lksctp-tools x86_64 1.0.17-2.el7 base 88 k nss-pem x86_64 1.0.3-5.el7 base 74 k python-javapackages noarch 3.4.1-11.el7 base 31 k python-lxml x86_64 3.2.1-4.el7 base 758 k ttmkfdir x86_64 3.0.9-42.el7 base 48 k tzdata-java noarch 2018i-1.el7 updates 187 k xorg-x11-font-utils x86_64 1:7.5-21.el7 base 104 k xorg-x11-fonts-Type1 noarch 7.5-9.el7 base 521 k Updating for dependencies: chkconfig x86_64 1.7.4-1.el7 base 181 k freetype x86_64 2.8-12.el7 base 380 k nspr x86_64 4.19.0-1.el7_5 base 127 k nss x86_64 3.36.0-7.el7_5 base 835 k nss-softokn x86_64 3.36.0-5.el7_5 base 315 k nss-softokn-freebl x86_64 3.36.0-5.el7_5 base 222 k nss-sysinit x86_64 3.36.0-7.el7_5 base 62 k nss-tools x86_64 3.36.0-7.el7_5 base 515 k nss-util x86_64 3.36.0-1.el7_5 base 78 k Transaction Summary ============================================================================================================================================================================= Install 1 Package (+31 Dependent packages) Upgrade ( 9 Dependent packages) Total download size: 40 M Downloading packages: Delta RPMs disabled because /usr/bin/applydeltarpm not installed. (1/41): dejavu-fonts-common-2.33-6.el7.noarch.rpm | 64 kB 00:00:00 (2/41): fontpackages-filesystem-1.44-8.el7.noarch.rpm | 9.9 kB 00:00:00 (3/41): copy-jdk-configs-3.3-10.el7_5.noarch.rpm | 21 kB 00:00:00 (4/41): freetype-2.8-12.el7.x86_64.rpm | 380 kB 00:00:00 (5/41): java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64.rpm | 254 kB 00:00:00 (6/41): chkconfig-1.7.4-1.el7.x86_64.rpm | 181 kB 00:00:00 (7/41): giflib-4.1.6-9.el7.x86_64.rpm | 40 kB 00:00:00 (8/41): javapackages-tools-3.4.1-11.el7.noarch.rpm | 73 kB 00:00:00 (9/41): libSM-1.2.2-2.el7.x86_64.rpm | 39 kB 00:00:00 (10/41): libX11-1.6.5-2.el7.x86_64.rpm | 606 kB 00:00:02 (11/41): dejavu-sans-fonts-2.33-6.el7.noarch.rpm | 1.4 MB 00:00:05 (12/41): libX11-common-1.6.5-2.el7.noarch.rpm | 164 kB 00:00:02 (13/41): libXau-1.0.8-2.1.el7.x86_64.rpm | 29 kB 00:00:00 (14/41): fontconfig-2.13.0-4.3.el7.x86_64.rpm | 254 kB 00:00:06 (15/41): libXi-1.7.9-1.el7.x86_64.rpm | 40 kB 00:00:00 (16/41): libXcomposite-0.4.4-4.1.el7.x86_64.rpm | 22 kB 00:00:00 (17/41): libXtst-1.2.3-1.el7.x86_64.rpm | 20 kB 00:00:00 (18/41): libXrender-0.9.10-1.el7.x86_64.rpm | 26 kB 00:00:00 (19/41): libICE-1.0.9-9.el7.x86_64.rpm | 66 kB 00:00:06 (20/41): libpng-1.5.13-7.el7_2.x86_64.rpm | 213 kB 00:00:00 (21/41): libfontenc-1.1.3-3.el7.x86_64.rpm | 31 kB 00:00:00 (22/41): libxcb-1.13-1.el7.x86_64.rpm | 214 kB 00:00:00 (23/41): libjpeg-turbo-1.2.90-6.el7.x86_64.rpm | 134 kB 00:00:00 (24/41): lksctp-tools-1.0.17-2.el7.x86_64.rpm | 88 kB 00:00:00 (25/41): nspr-4.19.0-1.el7_5.x86_64.rpm | 127 kB 00:00:00 (26/41): libxslt-1.1.28-5.el7.x86_64.rpm | 242 kB 00:00:01 (27/41): nss-3.36.0-7.el7_5.x86_64.rpm | 835 kB 00:00:01 (28/41): nss-softokn-freebl-3.36.0-5.el7_5.x86_64.rpm | 222 kB 00:00:00 (29/41): nss-sysinit-3.36.0-7.el7_5.x86_64.rpm | 62 kB 00:00:00 (30/41): nss-pem-1.0.3-5.el7.x86_64.rpm | 74 kB 00:00:01 (31/41): libXext-1.3.3-3.el7.x86_64.rpm | 39 kB 00:00:04 (32/41): python-javapackages-3.4.1-11.el7.noarch.rpm | 31 kB 00:00:00 (33/41): nss-tools-3.36.0-7.el7_5.x86_64.rpm | 515 kB 00:00:01 (34/41): nss-softokn-3.36.0-5.el7_5.x86_64.rpm | 315 kB 00:00:01 (35/41): ttmkfdir-3.0.9-42.el7.x86_64.rpm | 48 kB 00:00:00 (36/41): tzdata-java-2018i-1.el7.noarch.rpm | 187 kB 00:00:00 (37/41): xorg-x11-font-utils-7.5-21.el7.x86_64.rpm | 104 kB 00:00:00 (38/41): nss-util-3.36.0-1.el7_5.x86_64.rpm | 78 kB 00:00:01 (39/41): python-lxml-3.2.1-4.el7.x86_64.rpm | 758 kB 00:00:01 (40/41): xorg-x11-fonts-Type1-7.5-9.el7.noarch.rpm | 521 kB 00:00:01 (41/41): java-1.8.0-openjdk-headless-1.8.0.191.b12-1.el7_6.x86_64.rpm | 32 MB 00:00:17 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 2.3 MB/s | 40 MB 00:00:17 Running transaction check Running transaction test Transaction test succeeded Running transaction Updating : nspr-4.19.0-1.el7_5.x86_64 1/50 Updating : nss-util-3.36.0-1.el7_5.x86_64 2/50 Updating : chkconfig-1.7.4-1.el7.x86_64 3/50 Installing : libxslt-1.1.28-5.el7.x86_64 4/50 Installing : libjpeg-turbo-1.2.90-6.el7.x86_64 5/50 Installing : fontpackages-filesystem-1.44-8.el7.noarch 6/50 Installing : libICE-1.0.9-9.el7.x86_64 7/50 Installing : 2:libpng-1.5.13-7.el7_2.x86_64 8/50 Updating : freetype-2.8-12.el7.x86_64 9/50 Installing : ttmkfdir-3.0.9-42.el7.x86_64 10/50 Installing : libSM-1.2.2-2.el7.x86_64 11/50 Installing : dejavu-fonts-common-2.33-6.el7.noarch 12/50 Installing : dejavu-sans-fonts-2.33-6.el7.noarch 13/50 Installing : fontconfig-2.13.0-4.3.el7.x86_64 14/50 Installing : python-lxml-3.2.1-4.el7.x86_64 15/50 Installing : python-javapackages-3.4.1-11.el7.noarch 16/50 Installing : javapackages-tools-3.4.1-11.el7.noarch 17/50 Updating : nss-softokn-freebl-3.36.0-5.el7_5.x86_64 18/50 Updating : nss-softokn-3.36.0-5.el7_5.x86_64 19/50 Installing : nss-pem-1.0.3-5.el7.x86_64 20/50 Updating : nss-sysinit-3.36.0-7.el7_5.x86_64 21/50 Updating : nss-3.36.0-7.el7_5.x86_64 22/50 Installing : libfontenc-1.1.3-3.el7.x86_64 23/50 Installing : 1:xorg-x11-font-utils-7.5-21.el7.x86_64 24/50 Installing : xorg-x11-fonts-Type1-7.5-9.el7.noarch 25/50 Installing : libX11-common-1.6.5-2.el7.noarch 26/50 Installing : libXau-1.0.8-2.1.el7.x86_64 27/50 Installing : libxcb-1.13-1.el7.x86_64 28/50 Installing : libX11-1.6.5-2.el7.x86_64 29/50 Installing : libXext-1.3.3-3.el7.x86_64 30/50 Installing : libXi-1.7.9-1.el7.x86_64 31/50 Installing : libXtst-1.2.3-1.el7.x86_64 32/50 Installing : giflib-4.1.6-9.el7.x86_64 33/50 Installing : libXrender-0.9.10-1.el7.x86_64 34/50 Installing : libXcomposite-0.4.4-4.1.el7.x86_64 35/50 Installing : lksctp-tools-1.0.17-2.el7.x86_64 36/50 Installing : copy-jdk-configs-3.3-10.el7_5.noarch 37/50 Installing : tzdata-java-2018i-1.el7.noarch 38/50 Installing : 1:java-1.8.0-openjdk-headless-1.8.0.191.b12-1.el7_6.x86_64 39/50 Installing : 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64 40/50 Updating : nss-tools-3.36.0-7.el7_5.x86_64 41/50 Cleanup : nss-tools-3.19.1-18.el7.x86_64 42/50 Cleanup : nss-sysinit-3.19.1-18.el7.x86_64 43/50 Cleanup : nss-3.19.1-18.el7.x86_64 44/50 Cleanup : nss-softokn-3.16.2.3-13.el7_1.x86_64 45/50 Cleanup : nss-util-3.19.1-4.el7_1.x86_64 46/50 Cleanup : nspr-4.10.8-2.el7_1.x86_64 47/50 Cleanup : nss-softokn-freebl-3.16.2.3-13.el7_1.x86_64 48/50 Cleanup : chkconfig-1.3.61-5.el7.x86_64 49/50 Cleanup : freetype-2.4.11-11.el7.x86_64 50/50 Verifying : libXext-1.3.3-3.el7.x86_64 1/50 Verifying : libXi-1.7.9-1.el7.x86_64 2/50 Verifying : fontconfig-2.13.0-4.3.el7.x86_64 3/50 Verifying : 2:libpng-1.5.13-7.el7_2.x86_64 4/50 Verifying : giflib-4.1.6-9.el7.x86_64 5/50 Verifying : libXrender-0.9.10-1.el7.x86_64 6/50 Verifying : python-lxml-3.2.1-4.el7.x86_64 7/50 Verifying : tzdata-java-2018i-1.el7.noarch 8/50 Verifying : libICE-1.0.9-9.el7.x86_64 9/50 Verifying : nss-3.36.0-7.el7_5.x86_64 10/50 Verifying : fontpackages-filesystem-1.44-8.el7.noarch 11/50 Verifying : ttmkfdir-3.0.9-42.el7.x86_64 12/50 Verifying : freetype-2.8-12.el7.x86_64 13/50 Verifying : nss-util-3.36.0-1.el7_5.x86_64 14/50 Verifying : copy-jdk-configs-3.3-10.el7_5.noarch 15/50 Verifying : python-javapackages-3.4.1-11.el7.noarch 16/50 Verifying : nss-pem-1.0.3-5.el7.x86_64 17/50 Verifying : dejavu-fonts-common-2.33-6.el7.noarch 18/50 Verifying : libXcomposite-0.4.4-4.1.el7.x86_64 19/50 Verifying : libXtst-1.2.3-1.el7.x86_64 20/50 Verifying : libxcb-1.13-1.el7.x86_64 21/50 Verifying : libjpeg-turbo-1.2.90-6.el7.x86_64 22/50 Verifying : lksctp-tools-1.0.17-2.el7.x86_64 23/50 Verifying : xorg-x11-fonts-Type1-7.5-9.el7.noarch 24/50 Verifying : libxslt-1.1.28-5.el7.x86_64 25/50 Verifying : libX11-1.6.5-2.el7.x86_64 26/50 Verifying : 1:java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64 27/50 Verifying : dejavu-sans-fonts-2.33-6.el7.noarch 28/50 Verifying : nss-tools-3.36.0-7.el7_5.x86_64 29/50 Verifying : javapackages-tools-3.4.1-11.el7.noarch 30/50 Verifying : 1:java-1.8.0-openjdk-headless-1.8.0.191.b12-1.el7_6.x86_64 31/50 Verifying : nss-sysinit-3.36.0-7.el7_5.x86_64 32/50 Verifying : libXau-1.0.8-2.1.el7.x86_64 33/50 Verifying : nss-softokn-freebl-3.36.0-5.el7_5.x86_64 34/50 Verifying : libSM-1.2.2-2.el7.x86_64 35/50 Verifying : nspr-4.19.0-1.el7_5.x86_64 36/50 Verifying : libX11-common-1.6.5-2.el7.noarch 37/50 Verifying : 1:xorg-x11-font-utils-7.5-21.el7.x86_64 38/50 Verifying : chkconfig-1.7.4-1.el7.x86_64 39/50 Verifying : libfontenc-1.1.3-3.el7.x86_64 40/50 Verifying : nss-softokn-3.36.0-5.el7_5.x86_64 41/50 Verifying : freetype-2.4.11-11.el7.x86_64 42/50 Verifying : nss-tools-3.19.1-18.el7.x86_64 43/50 Verifying : nss-softokn-3.16.2.3-13.el7_1.x86_64 44/50 Verifying : nss-3.19.1-18.el7.x86_64 45/50 Verifying : nss-sysinit-3.19.1-18.el7.x86_64 46/50 Verifying : chkconfig-1.3.61-5.el7.x86_64 47/50 Verifying : nss-softokn-freebl-3.16.2.3-13.el7_1.x86_64 48/50 Verifying : nspr-4.10.8-2.el7_1.x86_64 49/50 Verifying : nss-util-3.19.1-4.el7_1.x86_64 50/50 Installed: java-1.8.0-openjdk.x86_64 1:1.8.0.191.b12-1.el7_6 Dependency Installed: copy-jdk-configs.noarch 0:3.3-10.el7_5 dejavu-fonts-common.noarch 0:2.33-6.el7 dejavu-sans-fonts.noarch 0:2.33-6.el7 fontconfig.x86_64 0:2.13.0-4.3.el7 fontpackages-filesystem.noarch 0:1.44-8.el7 giflib.x86_64 0:4.1.6-9.el7 java-1.8.0-openjdk-headless.x86_64 1:1.8.0.191.b12-1.el7_6 javapackages-tools.noarch 0:3.4.1-11.el7 libICE.x86_64 0:1.0.9-9.el7 libSM.x86_64 0:1.2.2-2.el7 libX11.x86_64 0:1.6.5-2.el7 libX11-common.noarch 0:1.6.5-2.el7 libXau.x86_64 0:1.0.8-2.1.el7 libXcomposite.x86_64 0:0.4.4-4.1.el7 libXext.x86_64 0:1.3.3-3.el7 libXi.x86_64 0:1.7.9-1.el7 libXrender.x86_64 0:0.9.10-1.el7 libXtst.x86_64 0:1.2.3-1.el7 libfontenc.x86_64 0:1.1.3-3.el7 libjpeg-turbo.x86_64 0:1.2.90-6.el7 libpng.x86_64 2:1.5.13-7.el7_2 libxcb.x86_64 0:1.13-1.el7 libxslt.x86_64 0:1.1.28-5.el7 lksctp-tools.x86_64 0:1.0.17-2.el7 nss-pem.x86_64 0:1.0.3-5.el7 python-javapackages.noarch 0:3.4.1-11.el7 python-lxml.x86_64 0:3.2.1-4.el7 ttmkfdir.x86_64 0:3.0.9-42.el7 tzdata-java.noarch 0:2018i-1.el7 xorg-x11-font-utils.x86_64 1:7.5-21.el7 xorg-x11-fonts-Type1.noarch 0:7.5-9.el7 Dependency Updated: chkconfig.x86_64 0:1.7.4-1.el7 freetype.x86_64 0:2.8-12.el7 nspr.x86_64 0:4.19.0-1.el7_5 nss.x86_64 0:3.36.0-7.el7_5 nss-softokn.x86_64 0:3.36.0-5.el7_5 nss-softokn-freebl.x86_64 0:3.36.0-5.el7_5 nss-sysinit.x86_64 0:3.36.0-7.el7_5 nss-tools.x86_64 0:3.36.0-7.el7_5 nss-util.x86_64 0:3.36.0-1.el7_5 Complete! [root@node101 bin]#
[root@node101 bin]# yum -y install java-1.8.0-openjdk-devel.x86_64 Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.tuna.tsinghua.edu.cn * updates: mirrors.tuna.tsinghua.edu.cn Resolving Dependencies --> Running transaction check ---> Package java-1.8.0-openjdk-devel.x86_64 1:1.8.0.191.b12-1.el7_6 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================= Package Arch Version Repository Size ============================================================================================================================================================================= Installing: java-1.8.0-openjdk-devel x86_64 1:1.8.0.191.b12-1.el7_6 updates 9.8 M Transaction Summary ============================================================================================================================================================================= Install 1 Package Total download size: 9.8 M Installed size: 40 M Downloading packages: java-1.8.0-openjdk-devel-1.8.0.191.b12-1.el7_6.x86_64.rpm | 9.8 MB 00:00:04 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : 1:java-1.8.0-openjdk-devel-1.8.0.191.b12-1.el7_6.x86_64 1/1 Verifying : 1:java-1.8.0-openjdk-devel-1.8.0.191.b12-1.el7_6.x86_64 1/1 Installed: java-1.8.0-openjdk-devel.x86_64 1:1.8.0.191.b12-1.el7_6 Complete! [root@node101 bin]#
2>.创建下载目录和存放软件的目录
[root@node101 ~]# mkdir -pv /yinzhengjie/download #用于存放下载文件的目录 mkdir: created directory ‘/yinzhengjie’ mkdir: created directory ‘/yinzhengjie/download’ [root@node101 ~]# [root@node101 ~]# mkdir -pv /yinzhengjie/softwares #用于安装软件的目录 mkdir: created directory ‘/yinzhengjie/softwares’ [root@node101 ~]# [root@node101 ~]#
2>.下载ElasticSearch软件
[root@node101 ~]# cd /yinzhengjie/download/ [root@node101 download]# [root@node101 download]# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.5.4.tar.gz [root@node101 download]# [root@node101 download]# ll -h total 109M -rw-r--r--. 1 root root 109M Jan 21 06:20 elasticsearch-6.5.4.tar.gz [root@node101 download]#
3>.解压tar包到制定存放软件到路径(目录结构说明)
[root@node101 download]# tar -zxf elasticsearch-6.5.4.tar.gz -C /yinzhengjie/softwares/ [root@node101 download]# [root@node101 download]# ll /yinzhengjie/softwares/elasticsearch-6.5.4/ total 448 drwxr-xr-x. 3 root root 4096 Jan 21 06:48 bin drwxr-xr-x. 2 root root 4096 Dec 17 16:21 config #存放ES配置文件,包括JVM参数配置也放在这里,大家可以使用ls名称查看,根据文件名称估计大家也明白了的十之八九了。 drwxr-xr-x. 3 root root 4096 Dec 17 16:21 lib #这里是存放依赖库文件,基本上都是一些jar包 -rw-r--r--. 1 root root 13675 Dec 17 16:15 LICENSE.txt drwxr-xr-x. 2 root root 4096 Dec 17 16:21 logs #存放日志的目录 drwxr-xr-x. 28 root root 4096 Dec 17 16:21 modules #ES的一些核心功能都是以模块的形式存放 -rw-r--r--. 1 root root 403816 Dec 17 16:21 NOTICE.txt drwxr-xr-x. 2 root root 4096 Dec 17 16:21 plugins #这里是存放ES第三方的一些插件信息 -rw-r--r--. 1 root root 8519 Dec 17 16:14 README.textile [root@node101 download]# [root@node101 download]#
4>.修改ES到配置文件(下面的配置基本我使用的是主机名,因此我们需要提前在“/etc/hosts”作相应的解析操作)
[root@node101 ~]# cp /yinzhengjie/softwares/elasticsearch-6.5.4/config/elasticsearch.yml /yinzhengjie/softwares/elasticsearch-6.5.4/config/elasticsearch.yml.`date +%F ` [root@node101 ~]# [root@node101 ~]# grep "cluster.name" /yinzhengjie/softwares/elasticsearch-6.5.4/config/elasticsearch.yml #cluster.name: my-application [root@node101 ~]# [root@node101 ~]# sed -i "s@^#cluster.name: my-application@cluster.name: yinzhengjie-elasticsearch@" /yinzhengjie/softwares/elasticsearch-6.5.4/config/elasticsearch.yml [root@node101 ~]# [root@node101 ~]# grep "cluster.name" /yinzhengjie/softwares/elasticsearch-6.5.4/config/elasticsearch.yml cluster.name: yinzhengjie-elasticsearch [root@node101 ~]# [root@node101 ~]# grep "node.name" /yinzhengjie/softwares/elasticsearch-6.5.4/config/elasticsearch.yml #node.name: node-1 [root@node101 ~]# [root@node101 ~]# sed -i "s@^#node.name: node-1@node.name: node101.yinzhengjie.org.cn@" /yinzhengjie/softwares/elasticsearch-6.5.4/config/elasticsearch.yml [root@node101 ~]# [root@node101 ~]# grep "node.name" /yinzhengjie/softwares/elasticsearch-6.5.4/config/elasticsearch.yml node.name: node101.yinzhengjie.org.cn [root@node101 ~]# [root@node101 ~]# grep network.host /yinzhengjie/softwares/elasticsearch-6.5.4/config/elasticsearch.yml #network.host: 192.168.0.1 [root@node101 ~]# [root@node101 ~]# sed -i "s@^#network.host: 192.168.0.1@network.host: node101.yinzhengjie.org.cn@" /yinzhengjie/softwares/elasticsearch-6.5.4/config/elasticsearch.yml [root@node101 ~]# [root@node101 ~]# grep network.host /yinzhengjie/softwares/elasticsearch-6.5.4/config/elasticsearch.yml network.host: node101.yinzhengjie.org.cn [root@node101 ~]# [root@node101 ~]#
以上修改,只是单机部署所需要修改上面配置的参数即可,如果有集群的话,应该还需要修改一个参数,具体修改内容如下:
[root@node101 ~]# cat /yinzhengjie/softwares/elasticsearch-6.5.4/config/elasticsearch.yml | egrep -v "^#|^$" cluster.name: yinzhengjie-elasticsearch #自定义当前节点所属集群的名称。 node.name: node101.yinzhengjie.org.cn #自定义节点的名称。 path.data: /yinzhengjie/softwares/elasticsearch-6.5.4/data #自定义存放数据的目录。 path.logs: /yinzhengjie/softwares/elasticsearch-6.5.4/logs #自定义存放日志的目录。 network.host: node101.yinzhengjie.org.cn #服务启动时绑定的IP地址,默认是loacalhost。 discovery.zen.ping.unicast.hosts: ["node101.yinzhengjie.org.cn:9300", "node102.yinzhengjie.org.cn:9300","node103.yinzhengjie.org.cn:9300"] #这里是集群的各个节点的IP地址,一定别忘记把端口加上哟!因为不加端口,可能有各别节点检测不到到情况! [root@node101 ~]#
5>.启动ES
[root@node101 download]# sysctl -q vm.max_map_count #调大虚拟内存映射 vm.max_map_count = 262144 [root@node101 download]# [root@node101 download]# ulimit -u #调大用户可以开启的最大进程数量 7268 [root@node101 download]# [root@node101 download]# id yinzhengjie #你可以使用useradd命令创建出来一个普通用户 uid=1000(yinzhengjie) gid=1000(yinzhengjie) groups=1000(yinzhengjie),10(wheel) [root@node101 download]# [root@node101 download]# chown yinzhengjie:yinzhengjie -R /yinzhengjie/softwares/elasticsearch-6.5.4/ #将ES整个目录授权给一个普通用户 [root@node101 download]# [root@node101 download]# cd /yinzhengjie/softwares/elasticsearch-6.5.4/bin/ #进入到ES到脚本目录 [root@node101 bin]# [root@node101 bin]# su yinzhengjie #切换到普通用户,因为ES默认是不支持以root身份运行哟! [yinzhengjie@node101 bin]$ [yinzhengjie@node101 bin]$ ./elasticsearch #启动ES
上面的启动方式是没有配置环境变量,我们可以将ES的bin路径加入到系统到PATH中,这样我们在任意一个位置都可以执行ES的相关命令啦~
[root@node101 bin]# echo "#Add by yinzhengjie" >> /etc/profile [root@node101 bin]# [root@node101 bin]# echo "export PATH=$PATH:/yinzhengjie/softwares/elasticsearch-6.5.4/bin" >> /etc/profile [root@node101 bin]# [root@node101 bin]# tail -2 /etc/profile #Add by yinzhengjie export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/yinzhengjie/softwares/elasticsearch-6.5.4/bin [root@node101 bin]# [root@node101 bin]# source /etc/profile #一般情况下,我不建议大家将环境变量配置在“~/.bash_profile”中,将环境变量定义在全局生效,目的就是为了切换用户时,我们配置的环境变量依旧有效! [root@node101 bin]# [root@node101 ~]# su yinzhengjie [yinzhengjie@node101 root]$
[yinzhengjie@node101 root]$ elasticsearch & [1] 13500 [yinzhengjie@node101 root]$ [yinzhengjie@node101 root]$ [2019-01-22T04:32:34,105][INFO ][o.e.e.NodeEnvironment ] [node105.yinzhengjie.org.cn] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [44.5gb], net total_space [49gb], types [rootfs] [2019-01-22T04:32:34,108][INFO ][o.e.e.NodeEnvironment ] [node105.yinzhengjie.org.cn] heap size [1007.3mb], compressed ordinary object pointers [true] [2019-01-22T04:32:34,109][INFO ][o.e.n.Node ] [node105.yinzhengjie.org.cn] node name [node105.yinzhengjie.org.cn], node ID [5Xyf16x8SNaMa_29D7452Q] [2019-01-22T04:32:34,110][INFO ][o.e.n.Node ] [node105.yinzhengjie.org.cn] version[6.5.4], pid[13500], build[default/tar/d2ef93d/2018-12-17T21:17:40.758843Z], OS[Linux/3.10.0-327.el7.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_191/25.191-b12] [2019-01-22T04:32:34,110][INFO ][o.e.n.Node ] [node105.yinzhengjie.org.cn] 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.fMUkI7Dv, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -XX:+PrintGCDetails, -XX:+PrintGCDateStamps, -XX:+PrintTenuringDistribution, -XX:+PrintGCApplicationStoppedTime, -Xloggc:logs/gc.log, -XX:+UseGCLogFileRotation, -XX:NumberOfGCLogFiles=32, -XX:GCLogFileSize=64m, -Des.path.home=/yinzhengjie/softwares/elasticsearch-6.5.4, -Des.path.conf=/yinzhengjie/softwares/elasticsearch-6.5.4/config, -Des.distribution.flavor=default, -Des.distribution.type=tar] [2019-01-22T04:32:35,811][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [aggs-matrix-stats] [2019-01-22T04:32:35,811][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [analysis-common] [2019-01-22T04:32:35,811][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [ingest-common] [2019-01-22T04:32:35,811][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [lang-expression] [2019-01-22T04:32:35,811][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [lang-mustache] [2019-01-22T04:32:35,811][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [lang-painless] [2019-01-22T04:32:35,812][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [mapper-extras] [2019-01-22T04:32:35,812][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [parent-join] [2019-01-22T04:32:35,812][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [percolator] [2019-01-22T04:32:35,812][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [rank-eval] [2019-01-22T04:32:35,812][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [reindex] [2019-01-22T04:32:35,812][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [repository-url] [2019-01-22T04:32:35,812][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [transport-netty4] [2019-01-22T04:32:35,812][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [tribe] [2019-01-22T04:32:35,812][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [x-pack-ccr] [2019-01-22T04:32:35,813][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [x-pack-core] [2019-01-22T04:32:35,813][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [x-pack-deprecation] [2019-01-22T04:32:35,813][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [x-pack-graph] [2019-01-22T04:32:35,813][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [x-pack-logstash] [2019-01-22T04:32:35,813][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [x-pack-ml] [2019-01-22T04:32:35,813][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [x-pack-monitoring] [2019-01-22T04:32:35,813][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [x-pack-rollup] [2019-01-22T04:32:35,813][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [x-pack-security] [2019-01-22T04:32:35,813][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [x-pack-sql] [2019-01-22T04:32:35,813][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [x-pack-upgrade] [2019-01-22T04:32:35,813][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] loaded module [x-pack-watcher] [2019-01-22T04:32:35,814][INFO ][o.e.p.PluginsService ] [node105.yinzhengjie.org.cn] no plugins loaded [2019-01-22T04:32:40,116][INFO ][o.e.x.s.a.s.FileRolesStore] [node105.yinzhengjie.org.cn] parsed [0] roles from file [/yinzhengjie/softwares/elasticsearch-6.5.4/config/roles.yml] [2019-01-22T04:32:40,748][INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [node105.yinzhengjie.org.cn] [controller/13553] [Main.cc@109] controller (64 bit): Version 6.5.4 (Build b616085ef32393) Copyright (c) 2018 Elasticsearch BV [2019-01-22T04:32:41,146][DEBUG][o.e.a.ActionModule ] [node105.yinzhengjie.org.cn] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security [2019-01-22T04:32:41,362][INFO ][o.e.d.DiscoveryModule ] [node105.yinzhengjie.org.cn] using discovery type [zen] and host providers [settings] [2019-01-22T04:32:42,255][INFO ][o.e.n.Node ] [node105.yinzhengjie.org.cn] initialized [2019-01-22T04:32:42,255][INFO ][o.e.n.Node ] [node105.yinzhengjie.org.cn] starting ... [2019-01-22T04:32:42,414][INFO ][o.e.t.TransportService ] [node105.yinzhengjie.org.cn] publish_address {172.30.1.105:9300}, bound_addresses {172.30.1.105:9300} [2019-01-22T04:32:42,433][INFO ][o.e.b.BootstrapChecks ] [node105.yinzhengjie.org.cn] bound or publishing to a non-loopback address, enforcing bootstrap checks [2019-01-22T04:32:45,524][INFO ][o.e.c.s.MasterService ] [node105.yinzhengjie.org.cn] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {node105.yinzhengjie.org.cn}{5Xyf16x8SNaMa_29D7452Q}{o8lotI6GSg2kQtrFkHf9Eg}{node105.yinzhengjie.org.cn}{172.30.1.105:9300}{ml.machine_memory=1925455872, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} [2019-01-22T04:32:45,530][INFO ][o.e.c.s.ClusterApplierService] [node105.yinzhengjie.org.cn] new_master {node105.yinzhengjie.org.cn}{5Xyf16x8SNaMa_29D7452Q}{o8lotI6GSg2kQtrFkHf9Eg}{node105.yinzhengjie.org.cn}{172.30.1.105:9300}{ml.machine_memory=1925455872, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}, reason: apply cluster state (from master [master {node105.yinzhengjie.org.cn}{5Xyf16x8SNaMa_29D7452Q}{o8lotI6GSg2kQtrFkHf9Eg}{node105.yinzhengjie.org.cn}{172.30.1.105:9300}{ml.machine_memory=1925455872, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]]) [2019-01-22T04:32:45,561][INFO ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [node105.yinzhengjie.org.cn] publish_address {172.30.1.105:9200}, bound_addresses {172.30.1.105:9200} [2019-01-22T04:32:45,561][INFO ][o.e.n.Node ] [node105.yinzhengjie.org.cn] started [2019-01-22T04:32:45,772][WARN ][o.e.x.s.a.s.m.NativeRoleMappingStore] [node105.yinzhengjie.org.cn] Failed to clear cache for realms [[]] [2019-01-22T04:32:45,813][INFO ][o.e.l.LicenseService ] [node105.yinzhengjie.org.cn] license [c7460796-3839-404e-9b75-6dcb4e6992fe] mode [basic] - valid [2019-01-22T04:32:45,824][INFO ][o.e.g.GatewayService ] [node105.yinzhengjie.org.cn] recovered [0] indices into cluster_state
6>.启动ES报错汇总
解决方案:
根据报错提示信息,是由于咱们的默认配置未能达到ES的要求,因此启动失败了,我们按照其要求,修改Linux系统对应的配置文件,于此同时,我还做了一些其他的优化参数。
[root@node101 ~]# cat /etc/security/limits.conf |egrep -v '^#|^$' * soft nofile 1000000 * hard nofile 1048576 * soft nproc 65536 * hard nproc unlimited * soft memlock unlimited * hard memlock unlimited [root@node101 ~]#
[root@node101 ~]# cat /etc/sysctl.conf | egrep -v '^#|^$' net.ipv6.conf.all.disable_ipv6 = 1 vm.dirty_ratio = 80 vm.dirty_background_ratio = 5 vm.swappiness = 1 net.core.wmem_default = 256960 net.core.rmem_default = 256960 net.ipv4.tcp_wmem = 8760 256960 4088000 net.ipv4.tcp_rmem = 8760 256960 4088000 net.ipv4.tcp_window_scaling = 1 net.ipv4.tcp_max_syn_backlog = 2048 net.core.netdev_max_backlog = 2000 vm.max_map_count = 262144 [root@node101 ~]#
7>.访问ES的RESTFUL API接口
由于ES是基于http协议的,因此我们可以通过浏览器访问,当然我们也可以使用curl命令来模拟浏览器。
[root@node101 ~]# systemctl status firewalld ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2019-01-21 04:56:56 EST; 17h ago Main PID: 716 (firewalld) CGroup: /system.slice/firewalld.service └─716 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid Jan 21 04:56:56 node101.yinzhengjie.org.cn systemd[1]: Starting firewalld - dynamic firewall daemon... Jan 21 04:56:56 node101.yinzhengjie.org.cn systemd[1]: Started firewalld - dynamic firewall daemon. [root@node101 ~]# [root@node101 ~]# [root@node101 ~]# systemctl stop firewalld [root@node101 ~]# [root@node101 ~]# systemctl disable firewalld Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service. Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service. [root@node101 ~]#
关闭防火墙后,我们再次访问WebUI,如下图所示:
上面是查看某个节点是否工作正常,如果想要查看整个集群的所有节点信息,我们可以在浏览器输入:http://node101.yinzhengjie.org.cn:9200/_cat/nodes。
当然我们也可以通过curl命令来模拟http请求,详情请参考:https://www.cnblogs.com/yinzhengjie/p/10226567.html。
8>.等待集群每个节点都启动成功后,我们任意选取一个节点在9300端口进行抓包(部署过程重复上述的2~6步骤)
[root@node101 ~]# yum -y install tcpdump Loaded plugins: fastestmirror base | 3.6 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 Loading mirror speeds from cached hostfile * base: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.tuna.tsinghua.edu.cn * updates: mirrors.tuna.tsinghua.edu.cn Resolving Dependencies --> Running transaction check ---> Package tcpdump.x86_64 14:4.9.2-3.el7 will be installed --> Processing Dependency: libpcap >= 14:1.5.3-10 for package: 14:tcpdump-4.9.2-3.el7.x86_64 --> Processing Dependency: libcrypto.so.10(OPENSSL_1.0.2)(64bit) for package: 14:tcpdump-4.9.2-3.el7.x86_64 --> Running transaction check ---> Package libpcap.x86_64 14:1.5.3-8.el7 will be updated ---> Package libpcap.x86_64 14:1.5.3-11.el7 will be an update ---> Package openssl-libs.x86_64 1:1.0.1e-42.el7.9 will be updated --> Processing Dependency: openssl-libs(x86-64) = 1:1.0.1e-42.el7.9 for package: 1:openssl-1.0.1e-42.el7.9.x86_64 ---> Package openssl-libs.x86_64 1:1.0.2k-16.el7 will be an update --> Running transaction check ---> Package openssl.x86_64 1:1.0.1e-42.el7.9 will be updated ---> Package openssl.x86_64 1:1.0.2k-16.el7 will be an update --> Finished Dependency Resolution Dependencies Resolved ================================================================================================================================= Package Arch Version Repository Size ================================================================================================================================= Installing: tcpdump x86_64 14:4.9.2-3.el7 base 421 k Updating for dependencies: libpcap x86_64 14:1.5.3-11.el7 base 138 k openssl x86_64 1:1.0.2k-16.el7 base 493 k openssl-libs x86_64 1:1.0.2k-16.el7 base 1.2 M Transaction Summary ================================================================================================================================= Install 1 Package Upgrade ( 3 Dependent packages) Total download size: 2.2 M Downloading packages: Delta RPMs disabled because /usr/bin/applydeltarpm not installed. (1/4): libpcap-1.5.3-11.el7.x86_64.rpm | 138 kB 00:00:00 (2/4): openssl-1.0.2k-16.el7.x86_64.rpm | 493 kB 00:00:00 (3/4): openssl-libs-1.0.2k-16.el7.x86_64.rpm | 1.2 MB 00:00:02 (4/4): tcpdump-4.9.2-3.el7.x86_64.rpm | 421 kB 00:00:05 --------------------------------------------------------------------------------------------------------------------------------- Total 428 kB/s | 2.2 MB 00:00:05 Running transaction check Running transaction test Transaction test succeeded Running transaction Updating : 1:openssl-libs-1.0.2k-16.el7.x86_64 1/7 Updating : 14:libpcap-1.5.3-11.el7.x86_64 2/7 Installing : 14:tcpdump-4.9.2-3.el7.x86_64 3/7 Updating : 1:openssl-1.0.2k-16.el7.x86_64 4/7 Cleanup : 1:openssl-1.0.1e-42.el7.9.x86_64 5/7 Cleanup : 1:openssl-libs-1.0.1e-42.el7.9.x86_64 6/7 Cleanup : 14:libpcap-1.5.3-8.el7.x86_64 7/7 Verifying : 1:openssl-libs-1.0.2k-16.el7.x86_64 1/7 Verifying : 14:tcpdump-4.9.2-3.el7.x86_64 2/7 Verifying : 1:openssl-1.0.2k-16.el7.x86_64 3/7 Verifying : 14:libpcap-1.5.3-11.el7.x86_64 4/7 Verifying : 1:openssl-libs-1.0.1e-42.el7.9.x86_64 5/7 Verifying : 14:libpcap-1.5.3-8.el7.x86_64 6/7 Verifying : 1:openssl-1.0.1e-42.el7.9.x86_64 7/7 Installed: tcpdump.x86_64 14:4.9.2-3.el7 Dependency Updated: libpcap.x86_64 14:1.5.3-11.el7 openssl.x86_64 1:1.0.2k-16.el7 openssl-libs.x86_64 1:1.0.2k-16.el7 Complete! [root@node101 ~]#
[root@node101 ~]# tcpdump -i eth0 -nn tcp port 9300 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes 02:04:59.933131 IP 172.30.1.101.55292 > 172.30.1.103.9300: Flags [P.], seq 1246209247:1246209829, ack 2013454372, win 457, options [nop,nop,TS val 75787846 ecr 75787915], length 582 02:04:59.934532 IP 172.30.1.103.9300 > 172.30.1.101.55292: Flags [P.], seq 1:22, ack 582, win 908, options [nop,nop,TS val 75788919 ecr 75787846], length 21 02:04:59.934565 IP 172.30.1.101.55292 > 172.30.1.103.9300: Flags [.], ack 22, win 457, options [nop,nop,TS val 75787848 ecr 75788919], length 0 02:05:00.198934 IP 172.30.1.103.44646 > 172.30.1.102.9300: Flags [P.], seq 2588914350:2588914933, ack 2467281115, win 457, options [nop,nop,TS val 75789183 ecr 75790192], length 583 02:05:00.200415 IP 172.30.1.102.9300 > 172.30.1.103.44646: Flags [P.], seq 1:22, ack 583, win 981, options [nop,nop,TS val 75791196 ecr 75789183], length 21 02:05:00.200566 IP 172.30.1.103.44646 > 172.30.1.102.9300: Flags [.], ack 22, win 457, options [nop,nop,TS val 75789185 ecr 75791196], length 0 02:05:00.532416 IP 172.30.1.102.55039 > 172.30.1.103.9300: Flags [P.], seq 3970203539:3970204121, ack 2677043169, win 457, options [nop,nop,TS val 75791528 ecr 75788514], length 582 02:05:00.533593 IP 172.30.1.103.9300 > 172.30.1.102.55039: Flags [P.], seq 1:22, ack 582, win 980, options [nop,nop,TS val 75789518 ecr 75791528], length 21 02:05:00.533742 IP 172.30.1.102.55039 > 172.30.1.103.9300: Flags [.], ack 22, win 457, options [nop,nop,TS val 75791529 ecr 75789518], length 0 02:05:00.559170 IP 172.30.1.103.50844 > 172.30.1.101.9300: Flags [P.], seq 1189434536:1189435119, ack 2740757556, win 457, options [nop,nop,TS val 75789543 ecr 75787470], length 583 02:05:00.560468 IP 172.30.1.101.9300 > 172.30.1.103.50844: Flags [P.], seq 1:22, ack 583, win 927, options [nop,nop,TS val 75788474 ecr 75789543], length 21 02:05:00.560662 IP 172.30.1.103.50844 > 172.30.1.101.9300: Flags [.], ack 22, win 457, options [nop,nop,TS val 75789545 ecr 75788474], length 0 02:05:00.936828 IP 172.30.1.101.55292 > 172.30.1.103.9300: Flags [P.], seq 582:1164, ack 22, win 457, options [nop,nop,TS val 75788850 ecr 75788919], length 582 02:05:00.938147 IP 172.30.1.103.9300 > 172.30.1.101.55292: Flags [P.], seq 22:43, ack 1164, win 926, options [nop,nop,TS val 75789922 ecr 75788850], length 21 02:05:00.938172 IP 172.30.1.101.55292 > 172.30.1.103.9300: Flags [.], ack 43, win 457, options [nop,nop,TS val 75788851 ecr 75789922], length 0 02:05:01.203748 IP 172.30.1.103.44646 > 172.30.1.102.9300: Flags [P.], seq 583:1166, ack 22, win 457, options [nop,nop,TS val 75790188 ecr 75791196], length 583 02:05:01.205242 IP 172.30.1.102.9300 > 172.30.1.103.44646: Flags [P.], seq 22:43, ack 1166, win 1000, options [nop,nop,TS val 75792201 ecr 75790188], length 21 02:05:01.205400 IP 172.30.1.103.44646 > 172.30.1.102.9300: Flags [.], ack 43, win 457, options [nop,nop,TS val 75790190 ecr 75792201], length 0 02:05:01.537031 IP 172.30.1.102.55039 > 172.30.1.103.9300: Flags [P.], seq 582:1164, ack 22, win 457, options [nop,nop,TS val 75792532 ecr 75789518], length 582 02:05:01.538370 IP 172.30.1.103.9300 > 172.30.1.102.55039: Flags [P.], seq 22:43, ack 1164, win 999, options [nop,nop,TS val 75790523 ecr 75792532], length 21 02:05:01.538526 IP 172.30.1.102.55039 > 172.30.1.103.9300: Flags [.], ack 43, win 457, options [nop,nop,TS val 75792534 ecr 75790523], length 0 02:05:01.562706 IP 172.30.1.103.50844 > 172.30.1.101.9300: Flags [P.], seq 583:1166, ack 22, win 457, options [nop,nop,TS val 75790547 ecr 75788474], length 583 02:05:01.564025 IP 172.30.1.101.9300 > 172.30.1.103.50844: Flags [P.], seq 22:43, ack 1166, win 945, options [nop,nop,TS val 75789477 ecr 75790547], length 21 02:05:01.564152 IP 172.30.1.103.50844 > 172.30.1.101.9300: Flags [.], ack 43, win 457, options [nop,nop,TS val 75790549 ecr 75789477], length 0 02:05:01.940667 IP 172.30.1.101.55292 > 172.30.1.103.9300: Flags [P.], seq 1164:1746, ack 43, win 457, options [nop,nop,TS val 75789854 ecr 75789922], length 582 02:05:01.942028 IP 172.30.1.103.9300 > 172.30.1.101.55292: Flags [P.], seq 43:64, ack 1746, win 944, options [nop,nop,TS val 75790926 ecr 75789854], length 21 02:05:01.942086 IP 172.30.1.101.55292 > 172.30.1.103.9300: Flags [.], ack 64, win 457, options [nop,nop,TS val 75789855 ecr 75790926], length 0 02:05:02.207387 IP 172.30.1.103.44646 > 172.30.1.102.9300: Flags [P.], seq 1166:1749, ack 43, win 457, options [nop,nop,TS val 75791192 ecr 75792201], length 583 02:05:02.208589 IP 172.30.1.102.9300 > 172.30.1.103.44646: Flags [P.], seq 43:64, ack 1749, win 1018, options [nop,nop,TS val 75793204 ecr 75791192], length 21 02:05:02.208714 IP 172.30.1.103.44646 > 172.30.1.102.9300: Flags [.], ack 64, win 457, options [nop,nop,TS val 75791193 ecr 75793204], length 0 02:05:02.540988 IP 172.30.1.102.55039 > 172.30.1.103.9300: Flags [P.], seq 1164:1746, ack 43, win 457, options [nop,nop,TS val 75793536 ecr 75790523], length 582 02:05:02.542122 IP 172.30.1.103.9300 > 172.30.1.102.55039: Flags [P.], seq 43:64, ack 1746, win 1017, options [nop,nop,TS val 75791526 ecr 75793536], length 21 02:05:02.542216 IP 172.30.1.102.55039 > 172.30.1.103.9300: Flags [.], ack 64, win 457, options [nop,nop,TS val 75793538 ecr 75791526], length 0 02:05:02.566412 IP 172.30.1.103.50844 > 172.30.1.101.9300: Flags [P.], seq 1166:1749, ack 43, win 457, options [nop,nop,TS val 75791551 ecr 75789477], length 583 02:05:02.567424 IP 172.30.1.101.9300 > 172.30.1.103.50844: Flags [P.], seq 43:64, ack 1749, win 963, options [nop,nop,TS val 75790481 ecr 75791551], length 21 02:05:02.567576 IP 172.30.1.103.50844 > 172.30.1.101.9300: Flags [.], ack 64, win 457, options [nop,nop,TS val 75791552 ecr 75790481], length 0 ^C 36 packets captured 36 packets received by filter 0 packets dropped by kernel [root@node101 ~]#
参考链接:https://www.elastic.co/cn/。