腊八粥 2019-06-28
导入Elasticsearch PGP Keyedit(必须)
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
可以使用rpm库或者zip安装,我比较习惯用rpm库.
cd /etc/yum.repos.d/ vi elasticsearch.repo
在shell添加内容
[elasticsearch-5.x] name=Elasticsearch repository for 5.x packages baseurl=https://artifacts.elastic.co/packages/5.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=1 autorefresh=1 type=rpm-md
官方库的连接不太稳定,需要多一点耐心.
yum install elasticsearch
Elasticsearch 并不会在安装完成后自动运行.如何启动和停止Elasticsearch 取决于系统使用init
活在systemd
.你可以运行以下命令查看操作系统的配置:
ps -p 1
结果:
PID TTY TIME CMD 1 ? 00:00:42 systemd
配置系统启动时自动开启Elasticsearch服务,需要运行以下命令:
/bin/systemctl daemon-reload /bin/systemctl enable elasticsearch.service
Elasticsearch 可以使用以下命令启动和停止:
systemctl start elasticsearch.service systemctl stop elasticsearch.service
systemctl start elasticsearch.service
启动Elasticsearch后无法访问,查看日志可知java内存溢出了.我的阿里云是最低配的,Elasticsearch默认javaopts是" -Xms2g -Xmx2g",需要修改Elasticsearch的默认参数.
修改文件/etc/sysconfig/elasticsearch
中的ES_JAVA_OPTS
参数为:" -Xms368m -Xmx368m"
,即可正常启动.
使用curl -XGET 'localhost:9200/?pretty'
测试,返回值为:
{ "name" : "DC4Gp5f", "cluster_name" : "elasticsearch", "cluster_uuid" : "ylqKangATqGRXkMCsVVwFg", "version" : { "number" : "5.1.1", "build_hash" : "5395e21", "build_date" : "2016-12-06T12:36:15.409Z", "build_snapshot" : false, "lucene_version" : "6.3.0" }, "tagline" : "You Know, for Search" }
elasticsearch的rpm仓库已安装,现在可以直接搜索安装kibana
yum search kibana yum install kibana
配置kibana随机启动:
/bin/systemctl daemon-reload /bin/systemctl enable kibana.service
启动,停止命令:
systemctl start kibana.service systemctl stop kibana.service
访问kibana:curl localhost:5601
另外一部分,则需要先做聚类、分类处理,将聚合出的分类结果存入ES集群的聚类索引中。数据处理层的聚合结果存入ES中的指定索引,同时将每个聚合主题相关的数据存入每个document下面的某个field下。