wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.2.tar.gz
tar -xvf elasticsearch-6.7.2.tar.gz
cat /etc/hosts
192.168.100.77 NJ100077 node-10077
192.168.100.78 NJ100078 node-10078
192.168.100.79 NJ100079 node-10079
# cat /data/elasticsearch-6.7.2/config/elasticsearch.yml |grep -v "^#"
cluster.name: flink-es
node.name: node-10078
network.host: 0.0.0.0
discovery.zen.ping.unicast.hosts: ["node-10077", "node-10078","node-10079"]
discovery.zen.minimum_master_nodes: 2
#----登陸驗證
xpack.security.enabled: true
http.cors.enabled: true
http.cors.allow-origin: '*'
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type
添加登陸驗證
啓用trial license
curl -H "Content-Type:application/json" -XPOST http://192.168.100.78:9200/_xpack/license/start_trial?acknowledge=true
設置密碼
./bin/elasticsearch-setup-passwords interactive
修改密碼
curl -H "Content-Type:application/json" -XPOST -u elastic 'http://192.168.100.78:9200/_xpack/security/user/elastic/_password' -d '{ "password" : "123456" }'
elasticsearch.yml中開啓安全驗證配置
xpack.security.enabled: true
head插件訪問
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type
======
遇到的問題處理:
1,es需用普通用戶啓動
2,報錯 [1]: max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
解 #vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
3,[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解 #vim /etc/sysctl.conf
vm.max_map_count=655360
#sysctl -p