准备资料:JDK ElasticSearch-6.5.3 Kibana Logstash
链接:https://pan.baidu.com/s/1TMpMvXjMvUbpVnpfBIJDXA
提取码:e1jz
安装环境:CentOS 7.3
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.5.3.tar.gz
wget https://artifacts.elastic.co/downloads/kibana/kibana-6.5.3-linux-x86_64.tar.gz
wget https://artifacts.elastic.co/downloads/logstash/logstash-6.5.3.tar.gz
第一步:创建账号
[root@izwz99z5o9dc90keftqhlrz ~]# useradd es
[root@izwz99z5o9dc90keftqhlrz ~]# passwd es
123456
123456
第二步:安装JDK
[root@izwz99z5o9dc90keftqhlrz ~]# tar -zxvf jdk-8u172-linux-x64.tar.gz -C /usr/local
配置环境变量,记得我们JDK使用root账户安装,免得后面总是提示没有权限:
[root@izwz99z5o9dc90keftqhlrz install]# vi /etc/profile
#加到最后面
PATH=$PATH:$HOME/bin
export JAVA_HOME=/usr/local/jdk1.8.0_172
export JRE_HOME=${JAVA_HOME}/jre
export PATH=$JAVA_HOME/bin:$PATH
export PATH
使环境变量立即生效:
[root@izwz99z5o9dc90keftqhlrz install]# source /etc/profile
测试一下:
[root@izwz99z5o9dc90keftqhlrz install]# echo $JAVA_HOME
/usr/local/jdk1.8.0_172
第三步:配置系统参数
vi /etc/sysctl.conf
在文件最后面添加内容:
vm.max_map_count=262144
保存后,执行
sysctl -p
vi /etc/security/limits.conf
添加如下内容:
* hard nofile 65536
* soft nofile 65536
* soft nproc 2048
* hard nproc 4096
第四步:安装Elastic
这时我们使用es账户登录,操作
开始安装:
[es@izwz99z5o9dc90keftqhlrz ~]$ tar -zxvf elasticsearch-6.5.3.tar-1.gz
配置:
修改内容(没有就添加):
cluster.name: es-wuneng
node.name: node-1
network.host: 0.0.0.0
http.port: 9200
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
测试运行:
进入Elasticsearch的bin目录
控制台 测试使用
[es@izwz99z5o9dc90keftqhlrz bin]$ ./elasticsearch
后台运行 生产使用
[es@izwz99z5o9dc90keftqhlrz bin]$ ./elasticsearch -d
运行成功的代码:
nodes joined)]])
[2019-10-23T22:29:42,887][INFO ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [node-1] publish_address {172.18.58.131:9200}, bound_addresses {0.0.0.0:9200}
[2019-10-23T22:29:42,887][INFO ][o.e.n.Node ] [node-1] started
[2019-10-23T22:29:42,935][WARN ][o.e.x.s.a.s.m.NativeRoleMappingStore] [node-1] Failed to clear cache for realms [[]]
[2019-10-23T22:29:43,111][INFO ][o.e.g.GatewayService ] [node-1] recovered [0] indices into cluster_state
[2019-10-23T22:29:43,659][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node-1] adding template [.watches] for index patterns [.watches*]
[2019-10-23T22:29:43,807][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node-1] adding template [.triggered_watches] for index patterns [.triggered_watches*]
[2019-10-23T22:29:43,887][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node-1] adding template [.watch-history-9] for index patterns [.watcher-history-9*]
[2019-10-23T22:29:44,036][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node-1] adding template [.monitoring-logstash] for index patterns [.monitoring-logstash-6-*]
[2019-10-23T22:29:44,126][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node-1] adding template [.monitoring-es] for index patterns [.monitoring-es-6-*]
[2019-10-23T22:29:44,233][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node-1] adding template [.monitoring-beats] for index patterns [.monitoring-beats-6-*]
[2019-10-23T22:29:44,316][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node-1] adding template [.monitoring-alerts] for index patterns [.monitoring-alerts-6]
[2019-10-23T22:29:44,376][INFO ][o.e.c.m.MetaDataIndexTemplateService] [node-1] adding template [.monitoring-kibana] for index patterns [.monitoring-kibana-6-*]
[2019-10-23T22:29:44,703][INFO ][o.e.l.LicenseService ] [node-1] license [1779b605-98c0-47cc-a0c3-f5c1d003c8f0] mode [basic] - valid
第五:安装错误处理
错误:
in 'reader', line 17, column 1:
cluster.name: es-xing
^
expected , but found Scalar
in 'reader', line 51, column 2:
-------------------------------- ...
^
at [Source: sun.nio.ch.ChannelInputStream@1e178745; line: 23, column: 18]]; nested: ParserException[while parsing a block mapping
in 'reader', line 17, column 1:
cluster.name: es-xing
^
expected , but found Scalar
in 'reader', line 51, column 2:
-------------------------------- ...
解决:加个空格就好了,每个选项 - 非常坑
这是说配置文件的问题:config/elasticsearch.yml
#
network.host: 0.0.0.0
#
# Set a custom port for HTTP:
#
http.port: 9200
问题:
ERROR: [1] bootstrap checks failed
[1]: max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
[2019-10-23T22:11:00,102][INFO ][o.e.n.Node ] [node-1] stopping ...
[2019-10-23T22:11:00,116][INFO ][o.e.n.Node ] [node-1] stopped
[2019-10-23T22:11:00,116][INFO ][o.e.n.Node ] [node-1] closing ...
[2019-10-23T22:11:00,160][INFO ][o.e.n.Node ] [node-1] closed
解决:root账户
vim /etc/security/limits.conf
# End of file
root soft nofile 65536
root hard nofile 65536
* soft nofile 65536
* hard nofile 65536
* soft nproc 2048
* hard nproc 4096
要改到:65536
然后用es再登录操作,原来那个窗口可能获取不到新参数
问题:内存不足
[2019-10-23T22:20:49,428][INFO ][o.e.d.DiscoveryModule ] [node-1] using discovery type [zen] and host providers [settings]
[2019-10-23T22:20:51,918][INFO ][o.e.n.Node ] [node-1] initialized
[2019-10-23T22:20:51,918][INFO ][o.e.n.Node ] [node-1] starting ...
[2019-10-23T22:20:52,713][INFO ][o.e.t.TransportService ] [node-1] publish_address {172.18.58.131:9300}, bound_addresses {0.0.0.0:9300}
[2019-10-23T22:20:52,855][INFO ][o.e.b.BootstrapChecks ] [node-1] bound or publishing to a non-loopback address, enforcing bootstrap checks
Killed
启动内存改小点:
[es@izwz99z5o9dc90keftqhlrz elasticsearch-6.5.3]$ vi config/jvm.options
#-Xms1g
#-Xmx1g
-Xms700m
-Xmx700m
ElasticSearch-6.5.3系列 安装篇二
参考:ELastic集群