centos7-elk之elasticsearch

准备环境:centos7.4

jdk:1.8

安装jdk可见链接:https://blog.csdn.net/xuejinyan123/article/details/102685458

下载 :elasticsearch 版本:6.0.1

存放路径:/opt/elk/elasticsearch-6.0.1

解压:tar -zxvf elasticsearch-6.0.1

elasticsearch配置:

#创建elk用户

adduser  -s /bin/bash -c 'elk' -m -d /home/elk elk

注:从2.0开始不能用root用户启动需要elk用户启动

修改配置文件:

vi elasticsearch.yml

path.data: /opt/elk/elasticsearch-6.0.1/data

path.logs: /opt/elk/elasticsearch-6.0.1/logs

network.host: 0.0.0.0

http.port: 9200

注释:

path.data:                          ----》存放数据路径

path.logs:                      -----》日志路径

network.host:                  -----》根据自己的ip修改

http.port:                       

#创建data,logs

[root@elk config]#mkdir /opt/elk/elasticsearch-6.0.1/data

[root@elk config]#mkdir /opt/elk/elasticsearch-6.0.1/logs

启动elasticsearch:

#修改elasticsearch权限

[root@elk ~]#chown -R elk.elk /opt/elk/elasticsearch-6.0.1

[root@elk ~]# su – elk

#在前台显示下效果

[elk@elk ~]$/opt/elk/elasticsearch-6.0.1/bin/elasticsearch

 如果执行完这个脚本,中途没有退出,说明启动成功

[2019-10-23T15:03:34,217][INFO ][o.e.p.PluginsService     ] [gtEEjvR] loaded module [analysis-common]
[2019-10-23T15:03:34,217][INFO ][o.e.p.PluginsService     ] [gtEEjvR] loaded module [ingest-common]
[2019-10-23T15:03:34,217][INFO ][o.e.p.PluginsService     ] [gtEEjvR] loaded module [lang-expression]
[2019-10-23T15:03:34,217][INFO ][o.e.p.PluginsService     ] [gtEEjvR] loaded module [lang-mustache]
[2019-10-23T15:03:34,217][INFO ][o.e.p.PluginsService     ] [gtEEjvR] loaded module [lang-painless]
[2019-10-23T15:03:34,217][INFO ][o.e.p.PluginsService     ] [gtEEjvR] loaded module [parent-join]
[2019-10-23T15:03:34,217][INFO ][o.e.p.PluginsService     ] [gtEEjvR] loaded module [percolator]
[2019-10-23T15:03:34,217][INFO ][o.e.p.PluginsService     ] [gtEEjvR] loaded module [reindex]
[2019-10-23T15:03:34,218][INFO ][o.e.p.PluginsService     ] [gtEEjvR] loaded module [repository-url]
[2019-10-23T15:03:34,218][INFO ][o.e.p.PluginsService     ] [gtEEjvR] loaded module [transport-netty4]
[2019-10-23T15:03:34,218][INFO ][o.e.p.PluginsService     ] [gtEEjvR] loaded module [tribe]
[2019-10-23T15:03:34,219][INFO ][o.e.p.PluginsService     ] [gtEEjvR] no plugins loaded
[2019-10-23T15:03:38,795][INFO ][o.e.d.DiscoveryModule    ] [gtEEjvR] using discovery type [zen]
[2019-10-23T15:03:40,590][INFO ][o.e.n.Node               ] initialized
[2019-10-23T15:03:40,590][INFO ][o.e.n.Node               ] [gtEEjvR] starting ...
[2019-10-23T15:03:41,283][INFO ][o.e.t.TransportService   ] [gtEEjvR] publish_address {192.168.16.18:9300}, bound_addresses {[::]:9300}
[2019-10-23T15:03:41,342][INFO ][o.e.b.BootstrapChecks    ] [gtEEjvR] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
[2019-10-23T15:03:44,482][INFO ][o.e.c.s.MasterService    ] [gtEEjvR] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {gtEEjvR}{gtEEjvRHQeqThfv0DvKbmw}{-5dj5qCQSAGMeLZUMnorCA}{192.168.16.18}{172.20.10.9:9300}
[2019-10-23T15:03:44,491][INFO ][o.e.c.s.ClusterApplierService] [gtEEjvR] new_master {gtEEjvR}{gtEEjvRHQeqThfv0DvKbmw}{-5dj5qCQSAGMeLZUMnorCA}{172.20.10.9}{172.20.10.9:9300}, reason: apply cluster state (from master [master {gtEEjvR}{gtEEjvRHQeqThfv0DvKbmw}{-5dj5qCQSAGMeLZUMnorCA}{192.168.16.18}{172.20.10.9:9300} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
[2019-10-23T15:03:44,611][INFO ][o.e.h.n.Netty4HttpServerTransport] [gtEEjvR] publish_address {192.168.16.18:9200}, bound_addresses {[::]:9200}
[2019-10-23T15:03:44,611][INFO ][o.e.n.Node               ] [gtEEjvR] started
[2019-10-23T15:03:45,255][INFO ][o.e.g.GatewayService     ] [gtEEjvR] recovered [4] indices into cluster_state
[2019-10-23T15:03:47,433][INFO ][o.e.c.r.a.AllocationService] [gtEEjvR] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[cmdb_hostd][3], [.kibana][0]] ...]).

#测试是否成功:

[root@elk ~]# curl 192.168.16.18:9200

{
  "name" : "gtEEjvR",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "cKFnzh3DRkimol38cXdysQ",
  "version" : {
    "number" : "6.0.1",
    "build_hash" : "601be4a",
    "build_date" : "2017-12-04T09:29:09.525Z",
    "build_snapshot" : false,
    "lucene_version" : "7.0.1",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

出现以上情况,证明elasticsearch可以正常使用

 

你可能感兴趣的:(elk)