下载elasticsearch-6.4.2.tar.gz,用root以外的用户登录服务器,上传文件并解压(以非root为例),进入/home/elasticsearch-6.4.2/config路径下,编辑elasticsearch.yml文件,其中比较重要的配置如下:
cluster.name: my-application // ES集群的名称
path.data: /home/elasticsearch-6.4.2/data // 数据存放路径
path.logs: /home/elasticsearch-6.4.2/logs // 日志存放路径
bootstrap.memory_lock: true // 是否锁定内存
network.host: 0.0.0.0 // 绑定请求地址
http.port: 9200 // 服务监听端口
进入bin下启动elasticsearch服务,报错信息如下:
ERROR: [1] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
编辑/etc/sysctl.conf,增加如下配置项:
vm.max_map_count=655360
ERROR: [2] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: memory locking requested for elasticsearch process but memory is not locked
编辑/etc/security/limits.conf配置文件,增加如下四行配置项:
* soft nofile 65536
* hard nofile 65536
* soft memlock unlimited
* hard memlock unlimited
ERROR: [3] bootstrap checks failed
[1]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
禁用:在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
修改系统配置需重新启动服务器(或者/sbin/sysctl -p)方可生效,再重启服务,执行curl http://127.0.0.1:9200/,查看服务状态如下:
[root@localhost security]# curl http://127.0.0.1:9200/
{
"name" : "Q1st7LW",
"cluster_name" : "my-application",
"cluster_uuid" : "VYy4SoltQb2ReyXVb89z3Q",
"version" : {
"number" : "6.4.2",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "04711c2",
"build_date" : "2018-09-26T13:34:09.098244Z",
"build_snapshot" : false,
"lucene_version" : "7.4.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
采用API方式查看服务状态,执行命令curl -i -XGET 'localhost:9200/_count?pretty',返回如下信息:
[homework@localhost elasticsearch-6.4.2]$ curl -i -XGET 'localhost:9200/_count?pretty'
HTTP/1.1 200 OK
content-type: application/json; charset=UTF-8
content-length: 114
{
"count" : 0,
"_shards" : {
"total" : 0,
"successful" : 0,
"skipped" : 0,
"failed" : 0
}
}
下载kibana-6.4.2-linux-x86_64.tar.gz上传服务器解压,进入/home/kibana-6.4.2-linux-x86_64/config路径下,编辑kibana.yml配置文件,主要的配置项如下:
server.port: 5601
server.host: "0.0.0.0"
elasticsearch.url: "http://172.23.129.222:9200"
kibana.index: ".kibana"
配置完成后启动即可,打开浏览器,http://172.23.129.222:5601,开始访问。
查看ES配置项:
GET _all/_settings
查看索引信息:
GET index_name/_settings
修改副本数量:
PUT index_name/_settings
{
"number_of_replicas": 2
}
修改窗口限值:
PUT index_name/_settings
{
"index":{
"max_result_window":10000
}
}