es单机版部署

es单机版部署

es单机版部署

es
useradd es 
cd /data/application/tools 
tar xvf elasticsearch-7.10.0-linux-x86_64.tar.gz  -C /data/application/app/ 
#创建目录
mkdir /data/application/data/es/data -p 
mkdir /data/application/logs/es/logs -p
#修改属主
chown es.es -R /data/application/logs/es/logs
chown es.es -R /data/application/data/es/data

chmod -R 755 /data/application/app/elasticsearch-7.10.0/ 
chown -R es.es /data/application/app/elasticsearch-7.10.0/ 

chmod -R 755  /data/application/data/es/ 
修改配置文件

elasticsearch.yml

#配置文件
vim elasticsearch.yml
path.data: /data/application/data/es/data
path.logs: /data/application/logs/es/logs
bootstrap.memory_lock: false
network.host: 0.0.0.0
http.port: 9967

transport.tcp.compress: true
http.cors.enabled: true
http.cors.allow-origin: "*"
cluster.initial_master_nodes: ["192.168.101.72:9300"]

# 注意
network.host: 0.0.0.0 修改为本机的IP地址
jvm.options
-Xms3g
-Xmx3g
系统参数调整
vi /etc/sysctl.conf 
vm.max_map_count=655360 
sysctl -p 
启动文件

vim /usr/lib/systemd/system/elasticsearch.service

[Unit]
Description=Elasticsearch Server Service
After=network.target

[Service]
User=es
Group=es
LimitNOFILE=655350
LimitNPROC=100000
PermissionsStartOnly=true
Environment=JAVA_HOME=/data/application/app/jdk1.8.0_121
ExecStart=/data/application/app/elasticsearch-7.10.0/bin/elasticsearch
ExecStop=/bin/kill -s QUIT $MAINPID
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target
启动
systemctl start elasticsearch
systemctl enable elasticsearch

systemctl status  elasticsearch
es 添加认证

配置文件添加

xpack.security.enabled: true
xpack.license.self_generated.type: basic
xpack.security.transport.ssl.enabled: true
重启
systemctl  restart  elasticsearch.service
systemctl  status elasticsearch.service
设置密码
cd /data/application/app/elasticsearch-7.10.0/bin 
./elasticsearch-setup-passwords interactive 
Please confirm that you would like to continue [y/N]y
.........
Enter password for [elastic]: 
Reenter password for [elastic]: 
Enter password for [apm_system]: 
Reenter password for [apm_system]: 
Enter password for [kibana_system]: 
Reenter password for [kibana_system]: 
Enter password for [logstash_system]: 
Reenter password for [logstash_system]: 
Enter password for [beats_system]: 
Reenter password for [beats_system]: 
Enter password for [remote_monitoring_user]: 
Reenter password for [remote_monitoring_user]: 
Changed password for user [apm_system]
Changed password for user [kibana_system]
Changed password for user [kibana]
Changed password for user [logstash_system]
Changed password for user [beats_system]
Changed password for user [remote_monitoring_user]
Changed password for user [elastic]
java 版本问题
future versions of Elasticsearch will require Java 11 警告解决

# now set the path to java
# 注释掉原来的配置信息
#if [ ! -z "$JAVA_HOME" ]; then
#  JAVA="$JAVA_HOME/bin/java"
#  JAVA_TYPE="JAVA_HOME"
#else
#  if [ "$(uname -s)" = "Darwin" ]; then
#    # macOS has a different structure
#    JAVA="$ES_HOME/jdk.app/Contents/Home/bin/java"
#  else
#    JAVA="$ES_HOME/jdk/bin/java"
#  fi
#  JAVA_TYPE="bundled jdk"
#fi
# 如何为新的配置信息
if [ ! -z "$JAVA_HOME" ]; then
  JAVA="$ES_HOME/jdk/bin/java"
  JAVA_TYPE="JAVA_HOME"
else
  if [ "$(uname -s)" = "Darwin" ]; then
    # macOS has a different structure
    JAVA="$ES_HOME/jdk.app/Contents/Home/bin/java"
  else
    JAVA="$ES_HOME/jdk/bin/java"
  fi  
  JAVA_TYPE="bundled jdk"
fi
测试es 认证
curl  localhosts:9200  -uelastic  
comments powered by Disqus