ElassticSearch 快速搭建 1 拉取并解压下载所需版本的 ES (本示例为 7.17.16) 在 elastic网站 下载对应压缩包,或直接wget
移动到服务器目录,例如 /home/elasticsearch/
解压
1 tar -zxvf elasticsearch-7.17.16-linux-x86_64.tar.gz
2 配置文件处理 2.1 修改配置文件 elasticsearch.yml 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 cd elasticsearch-7.17.16-linux-x86_64.tar.gzvim config/elasticsearch.yml discovery.type: single-node network.host: 0.0.0.0 http.port: 9200 http.cors.enabled: true http.cors.allow-origin: "*" http.cors.allow-headers: Authorization xpack.security.enabled: true
2.2 修改启动包中的jdk位置为ES自带的jdk 1 2 3 4 5 6 7 8 vim bin/elasticsearch export JAVA_HOME=/home/elasticsearch/elasticsearch-7.17.16/jdkexport PATH=$JAVA_HOME /bin:$PATH
2.3 修改es的jvm堆内存大小 1 2 3 4 5 6 7 8 vim config/jvm.options -Xms1g -Xms1g
3 创建es专用用户 1 2 3 4 5 6 7 8 sudo useradd user-es sudo passwd user-es sudo usermod -aG root user-es
4 启动 1 2 3 4 5 6 7 su user-es bin/elasticsearch bin/elasticsearch -d
5 设置es用户组密码 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 crul http://127.0.0.1:9200/ bin/elasticsearch-setup-passwords interactive Initiating the setup of passwords for reserved users elastic,apm_system,kibana,kibana_system,logstash_system,beats_system,remote_monitoring_user. You will be prompted to enter passwords as the process progresses. Please confirm that you would like to continue [y/N]y curl -u elastic:password http://127.0.0.1:9200/