Elasticsearch 6.3.0 安装与配置
安装jdk 1.8
创建 es 用户
groupadd -g 5000 es
useradd -g es -u 5000 es
安装 es
cd /usr
mkdir elasticsearch-6.3.0
chown -R es:es ./elasticsearch-6.3.0
su es
cd /usr/elasticsearch-6.3.0
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3.0.tar.gz
tar -zxvf elasticsearch-6.3.0.tar.gz
cd elasticsearch-6.3.0/bin
注意观察日志输出,几乎所有的程序,日志都是需要重点关注的。
此时启动的es是单节点模式,不是集群模式。
启动es
./elasticsearch
后台方式启动:
./elasticsearch -d
停止:
通过ps -ef | grep elastic 或者 jps等方式找到es pid
kill -9 pid
如果启动报错:
ERROR: [2] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解诀方案:
https://www.cnblogs.com/zhi-leaf/p/8484337.html
查看状态
{
"name" : "fLfDBwF",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "ATYMtul-TqSu01B3z8Cfrw",
"version" : {
"number" : "6.3.0",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "424e937",
"build_date" : "2018-06-11T23:38:03.357887Z",
"build_snapshot" : false,
"lucene_version" : "7.3.1",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
curl -X GET “localhost: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
1560829212 11:40:12 elasticsearch green 1 1 0 0 0 0 0 0 - 100.0%
curl -X GET “localhost:9200/_cat/nodes?v”
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
127.0.0.1 22 90 2 0.00 0.11 0.09 mdi * fLfDBwF
es 配置
参考:
https://blog.csdn.net/u012702547/article/details/83116699
https://blog.csdn.net/wolfcode_cn/article/details/81162802
es 与es-head
通过es-head连不上es:
集群健康值: 未连接
解决方案:
(1)elasticsearch下的 config/elasticsearch.yml 增加内容 :
http.cors.enabled: true
http.cors.allow-origin: "*"
(2)elasticsearch-head下Gruntfile.js 修改为:
connect: { server: { options: { hostname: '0.0.0.0', port: 9100, base: '.', keepalive: true } } }