linux安装elasticsearch,并设置用户登录校验

es版本7.6.2

0.创建新用户esuser并切换

创建用户
useradd useres
设置密码
passwd useres
切换用户
su - useres

1.下载es安装包并解压到用户目录下

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.2-linux-x86_64.tar.gz


2.添加配置

path.data: /home/useres/elasticsearch-7.6.2/data
path.logs: /home/useres/elasticsearch-7.6.2/logs
network.host: 0.0.0.0
node.name: node-1
cluster.initial_master_nodes: ["node-1"]


3.启动

./bin/elastisearch -d


4.添加鉴权配置

#允许head插件等访问的相关设置
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type
http.cors.allow-credentials: true
##是否启用es的安全设置,启用安全设置后es各节点、客户端的传输都会加密,并需要账号密码
xpack.security.enabled: true
##此项不可更改,当启用安全设置后,此项必须为true
xpack.security.transport.ssl.enabled: true


5.重启

kill xxx
./bin/elastisearch -d


6.初始化用户名和密码

./bin/elasticsearch-setup-passwords interactive

7.安装ik分词器

elasticsearch-plugin install file:///D:workElasticSearchx-pack-5.5.2.zip

8.重启使插件生效

tips:

1.需要先启动一次再添加鉴权配置,否则会报错

2.配置后需要通过用户登录后才可以调用es的api,但是没有开启ssl

你可能感兴趣的:(elasticsearch)