elastic就不多介绍了,一句话,牛逼的数据搜索中间件。
以下内容已经过时,太混乱了,重新整理于 https://www.isres.com/linux/117.html
安装jdk ,但只能是 9.0
https://blog.pucipuci.cn/post/59.html
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.1.2.tar.gz
tar -zxvf elasticsearch-6.1.2.tar.gz
mv elasticsearch-6.1.2 /usr/local/
#移动到 /usr/local/下
cd /usr/local/
cd elasticsearch-6.1.2
安装WEB监控工具(可选)
参考https://www.elastic.co/downloads/x-pack
bin/elasticsearch-plugin install x-pack
vim config/elasticsearch.yml
network.host: 0.0.0.0
http.port: 9200
#启动
bin/elasticsearch
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
由于Elasticsearch可以接收用户输入的脚本并且执行,为了系统安全考虑,
不允许root账号启动,所以建议给Elasticsearch单独创建一个用户来运行Elasticsearch。
groupadd es
useradd esuser -g es -p GFdw#$%78Pokk
chown -R esuser:es /usr/local/elasticsearch-6.1.2
su esuser
#启动elasticsearch
bin/elasticsearch -d #-d后台启动
ERROR: [4] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
解决:切换到root用户,编辑limits.conf 添加类似如下内容
vi /etc/security/limits.conf
添加如下内容:
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
vi /etc/security/limits.d/90-nproc.conf
* soft nproc 1024
#修改为
* soft nproc 4096
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
并执行命令:
sysctl -p
[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,而ES5.2.0默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。
解决:
在config/elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
以1-2-3上修改后,需要进行一个su的切换或重启服务器才能生效
bin/elasticsearch -d
要等大概半分钟 ,后台启动看不到什么信息。
su root
#防火墙开启 端口
-A INPUT -p tcp -m state --state NEW -m tcp --dport 9200 -j ACCEPT
#设置默认密码
bin/x-pack/setup-passwords auto
#密码修改为
Changed password for user kibana
PASSWORD kibana = vypQ9$hSlI6-dtQ#uME@
Changed password for user logstash_system
PASSWORD logstash_system = V6?s@e#dBhKC^zQDrXma
Changed password for user elastic
PASSWORD elastic = r8DrvME^s7b6X@=*W*-g
浏览器
http://192.168.1.146:9200/?pretty
输入 帐号密码
{
"name" : "corWxa7",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "kO48JzpwQYa9quJ1JpY9Xw",
"version" : {
"number" : "6.1.2",
"build_hash" : "5b1fea5",
"build_date" : "2018-01-10T02:35:59.208Z",
"build_snapshot" : false,
"lucene_version" : "7.1.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
开机启动脚本
es开机启动
es.sh
#!bin/bash
su - esuser<<!
cd /usr/local/elasticsearch-6.1.2
./bin/elasticsearch &
exit
!
vim /etc/rc.d/rc.local
sh /shell/es.sh
可选安装 :Kibana 是一个开源分析和可视化平台,旨在可视化操作 Elasticsearch 。
到官网根据不同操作系统下载最新版本的Kibana压缩包
wget https://artifacts.elastic.co/downloads/kibana/kibana-6.1.2-linux-x86_64.tar.gz
tar -zxvf kibana-6.1.2-linux-x86_64.tar.gz
mv kibana-6.1.2-linux-x86_64 /usr/local/kibana
cd /usr/local/kibana
vim config/kibana.yml
设置 elasticsearch.url: "http://127.0.0.1:9200"
运行 bin/kibana
log [08:11:28.565] [info][listening] Server running at http://localhost:5601
配置一下ip 让外网访问
vim config/kibana.yml
server.host: "192.168.1.146"
需要开启5601端口
后台运行
nohup bin/kibana &
效果
标签: elasticsearch
非特殊说明,本博所有文章均为博主原创。
如若转载,请注明出处:https://www.isres.com/nginx/74.html