【elasticsearch】最简ES安装

1.准备目录 

groupadd -g 60001 esadmin
useradd -u 61001 -g esadmin esadmin
chown -R esadmin:esadmin /esdb
chmod -R 775 /esdb
echo "esadmin" | passwd --stdin esadmin

2.解决配置yum文件乱码的问题。

cat >> /home/esadmin/.vimrc << EOF
map <F10>:set paste<CR>
map <F11>:set nopaste<CR>
EOF

3.解压安装。

elasticsearch-8.14.1-linux-x86_64.tar.gz 
jdk-17_linux-x64_bin.tar.gz 

tar xvf jdk-17_linux-x64_bin.tar.gz
tar xvf elasticsearch-8.14.1-linux-x86_64.tar.gz

vi ~/.bash_profile 


export LANG=en_US.UTF8
cat >> ~/.bash_profile << EOF
export JAVA_HOME=/esdb/jdk-17.0.11
export PATH=$PATH:$HOME/bin:/data/redis/src:/esdb/jdk-17.0.11/bin
export LANG=en_US.UTF8
EOF
source ~/.bash_profile
java -version

[root@oracle1 bin]# java -version
java version "17.0.11" 2024-04-16 LTS
Java(TM) SE Runtime Environment (build 17.0.11+7-LTS-207)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.11+7-LTS-207, mixed mode, sharing)

mv elasticsearch-8.14.1/* /esdb/esapp/esapp9200/   */

4.配置ES环境变量
vi /esdb/esapp/esapp9200/elasticsearch-env
export JAVA_HOME=/esdb/jdk-17.0.11
export PATH=$JAVA_HOME/bin:$PATH

5.配置ES启动文件 

vi /esdb/esapp/esapp9200/config/elasticsearch.yml
path.data: /esdb/esdata/esdata9200
path.logs: /esdb/eslog/eslog9200
bootstrap.memory_lock: true  --默认false,容易造成IO高。
#bootstrap.system_call_filter: false  --centos不支持这个参数。
network.host: 0.0.0.0  --访问ES的地址。
http.port: 9200
node.name: 192.168.1.7
cluster.initial_master_nodes: ["192.168.1.7"]


[esadmin@oracle1 config]$ cat elasticsearch.yml |grep -v ^# |grep -v ^$
path.data: /esdb/esdata/esdata9200
path.logs: /esdb/eslog/eslog9200
bootstrap.memory_lock: true  
network.host: 0.0.0.0  
http.port: 9200
node.name: 192.168.1.7
cluster.initial_master_nodes: ["192.168.1.7"]
xpack.security.enabled: true
xpack.security.enrollment.enabled: true
xpack.security.http.ssl:
  enabled: true
  keystore.path: certs/http.p12
xpack.security.transport.ssl:
  enabled: true
  verification_mode: certificate
  keystore.path: certs/transport.p12
  truststore.path: certs/transport.p12

6.尝试启动。

/esdb/esapp/esapp9200/bin/elasticsearch

max virtual memory areas vm.max_map_count [65530] is too low, 
increase to at least [262144];

vi /etc/sysctl.conf 
vm.max_map_count = 2048000
[root@oracle1 bin]# sysctl -p
vm.max_map_count = 2048000

--无法锁定内存。
bootstrap check failure [1] of [2]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]; for more information see [https://www.elastic.co/guide/en/elasticsearch/reference/8.14/_file_descriptor_check.html]
bootstrap check failure [2] of [2]: memory locking requested for elasticsearch process but memory is not locked; for more information see [https://www.elastic.co/guide/en/elasticsearch/reference/8.14/_memory_lock_check.html]
ERROR: Elasticsearch did not exit normally - check the logs at /esdb/eslog/eslog9200/elasticsearch.log
[2024-06-24T17:29:37,630][INFO ][o.e.n.Node               ] [192.168.1.7] stopping ...
[2024-06-24T17:29:37,692][INFO ][o.e.n.Node               ] [192.168.1.7] stopped
[2024-06-24T17:29:37,692][INFO ][o.e.n.Node               ] [192.168.1.7] closing ...
[2024-06-24T17:29:37,737][INFO ][o.e.n.Node               ] [192.168.1.7] closed
[2024-06-24T17:29:37,742][INFO ][o.e.x.m.p.NativeController] [192.168.1.7] Native controller process has stopped - no new native processes can be started

ERROR: Elasticsearch died while starting up, with exit code 78


--修改资源限制参数
cat >> /etc/security/limits.conf << EOF
root soft nofile 1048576
root hard nofile 1048576
esadmin soft nproc 1048576
esadmin hard nproc 1048576
esadmin soft nofile 1048576
esadmin hard nofile 1048576
esadmin soft stack 10240
esadmin hard stack 32768
esadmin hard memlock unlimited
esadmin soft memlock unlimited
EOF

--重新启动。
/esdb/esapp/esapp9200/bin/elasticsearch
[2024-06-24T17:34:12,193][INFO ][o.e.c.m.MetadataCreateIndexService] [192.168.1.7] [.security-7] creating index, cause [api], templates [], shards [1]/[0]
[2024-06-24T17:34:12,940][INFO ][o.e.c.r.a.AllocationService] [192.168.1.7] 
current.health="GREEN" message="Cluster health status changed from [YELLOW] 
to [GREEN] (reason: [shards started [[.security-7][0]]])." 
previous.health="YELLOW" reason="shards started [[.security-7][0]]"

--后台启动。
nohup /esdb/esapp/esapp9200/bin/elasticsearch > /esdb/eslog/eslog9200/nohup.es &

[esadmin@oracle1 ~]$ jps
52416 Elasticsearch
52353 CliToolLauncher
52422 Jps

7.访问测试 

curl 192.168.1.7:9200 
[esadmin@oracle1 ~]$ curl 192.168.1.7:9200 
curl: (52) Empty reply from server

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值