Elastic Search 安装和配置

目标

部署一个单节点的ElasticSearch集群

依赖

java环境

$java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)

安装

下载、解压

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.1.1.tar.gz
tar -zxvf elasticsearch-6.1.1.tar.gz
mv elasticsearch-6.1.1 /usr/local/

配置

config/elasticsearch.yml

cluster.name: my_cluster
node.name: master
path.data: /usr/local/elasticsearch-6.1.1/data
path.logs: /usr/local/elasticsearch-6.1.1/logs
network.host: 0.0.0.0
http.port: 9200

参数含义

  • cluster.name 用来指定集群的名称。如果不指定,则默认是 elasticsearch。
  • node.name 用来指定当前节点的名称,如果不指定,则会启动的时候自动生成一个随机唯一标识符作为节点的名称。
  • path.data 指定 ES 数据存储路径。
  • path.logs 指定 ES 日志文件存储路径。
  • network.host 用来指定服务端口绑定的 IP 地址,默认绑定 127.0.0.1 ,也就是只能本机访问。
  • http.port 用来指定提供 http 服务的端口。

启动

/usr/local/elasticsearch-6.1.1/bin/elasticsearch 

可能存在的问题

1. 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不能启动j解决:在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:

bootstrap.memory_lock: false
bootstrap.system_call_filter: false

验证

1.集群的基本信息:http://ip:9200/

{
name: "master",
cluster_name: "jihite-application",
cluster_uuid: "aT8N1FljTqK5QZrxUDaVuw",
version: {
number: "6.1.1",
build_hash: "bd92e7f",
build_date: "2017-12-17T20:23:25.338Z",
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"
}

2.健康信息:http://ip:9200/_cat/health?v

epoch      timestamp cluster            status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1552701815 10:03:35  jihite-application green           1         1      0   0    0    0        0             0                  -                100.0%
  • timestamp:代表状态时间
  • cluster:表示集群名称
  • status:表示集群状态。green 代表健康;yellow 代表数据完整,但是副本不完整;red 代表数据不完整
  • node.total:表示集群节点总数
  • node.data:表示集群数据节点总数
  • shards:表示集群分片的总数
  • active_shards_percent:表示集群活动的分片百分比
3.查看状态列表: http://ip:9200/_cat
=^.^=
/_cat/allocation
/_cat/shards
/_cat/shards/{index}
/_cat/master
/_cat/nodes
/_cat/tasks
/_cat/indices
/_cat/indices/{index}
/_cat/segments
/_cat/segments/{index}
/_cat/count
/_cat/count/{index}
/_cat/recovery
/_cat/recovery/{index}
/_cat/health
/_cat/pending_tasks
/_cat/aliases
/_cat/aliases/{alias}
/_cat/thread_pool
/_cat/thread_pool/{thread_pools}
/_cat/plugins
/_cat/fielddata
/_cat/fielddata/{fields}
/_cat/nodeattrs
/_cat/repositories
/_cat/snapshots/{repository}
/_cat/templates

参考

猜你喜欢

转载自www.cnblogs.com/kaituorensheng/p/10540864.html