cnetos安装es、kibana、ik

这里es使用的是7.10.2版本的es,物料包下载地址如下

#注意安装的插件需和es版本保持一致
#es
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.10.2-linux-x86_64.tar.gz
#kibana
https://artifacts.elastic.co/downloads/kibana/kibana-7.10.2-linux-x86_64.tar.gz
#ik插件
https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.10.2/elasticsearch-analysis-ik-7.10.2.zip

1:es不能在root用户下启动,必须创建新的用户,用来启动e

useradd es -s /bin/bash

2:进入 /home/es 目录下,上传下载好的安装包,解压

cd /home/es
#传包不方便的话直接wget下载以下安装包即可
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.10.2-linux-x86_64.tar.gz
#顺便下载下kibana安装包
https://artifacts.elastic.co/downloads/kibana/kibana-7.10.2-linux-x86_64.tar.gz

tar xzf elasticsearch-7.10.2-linux-x86_64.tar.gz
tar xzf kibana-7.10.2-linux-x86_64.tar.gz

3:对es、kibana目录授权

chown -R es:es elasticsearch-7.10.2
chown -R es:es kibana-7.10.2-linux-x86_64

4:创建数据、日志目录

mkdir -p /data/logs/es
mkdir -p /data/es/{data,work,plugins,scripts}

5:修改es配置文件

#es配置文件
vim /home/es/elasticsearch-7.10.2/config/elasticsearch.yml
node.name: node-1
network.host: 0.0.0.0
cluster.initial_master_nodes: ["node-1"] 

#kibana配置文件
vim /home/es/kibana-7.10.2-linux-x86_64/config/kibana.yml
server.port: 5601
server.host: "0.0.0.0"
elasticsearch.hosts: ["http://localhost:9200"]
kibana.index: ".kibana"
elasticsearch.username: "elastic"
elasticsearch.password: "123456"

6:启动es、kibana

#切换用户es
su es
#启动es(-d : 后台运行,不加则为运行并输入日志)
/home/es/elasticsearch-7.10.2/bin/elasticsearch -d
启动kibana
nohup /home/es/kibana-7.10.2-linux-x86_64/bin/kibana &

7:设置用户名密码

#配置文件添加下面内容,重启es
vim /home/es/elasticsearch-7.10.2/config/elasticsearch.yml
xpack.security.enabled: true
xpack.license.self_generated.type: basic
xpack.security.transport.ssl.enabled: true

#执行设置用户名和密码的命令,这里需要为4个用户分别设置密码,elastic, kibana, logstash_system,beats_system
/home/es/elasticsearch-7.10.2/bin/elasticsearch-setup-passwords interactive

Initiating the setup of passwords for reserved users elastic,apm_system,kibana,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
Enter password for [elastic]: 
Reenter password for [elastic]: 
Enter password for [elastic]: 
Reenter password for [elastic]: 
Enter password for [apm_system]: 
Reenter password for [apm_system]: 
Enter password for [kibana]: 
Reenter password for [kibana]: 
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]
Changed password for user [logstash_system]
Changed password for user [beats_system]
Changed password for user [remote_monitoring_user]
Changed password for user [elastic]

8:常见问题

8.1:max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

#通过命令查看
ulimit -Hn
ulimit -Sn
vi /etc/security/limits.conf
#添加以下配置信息
* soft nofile 65536
* hard nofile 65536

8.2:启动后报错:max number of threads [3818] for user [es] is too low, increase to at least [4096]

vi /etc/security/limits.conf
#添加以下配置信息
* soft nproc 4096
* hard nproc 4096

8.3:启动后报错:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

#修改/etc/sysctl.conf文件
vi /etc/sysctl.conf
#增加配置
vm.max_map_count=262144
#执行命令sysctl -p生效
sysctl -p

安装ik插件

#进入es-plugins
cd /home/es/elasticsearch-7.10.2/plugins
#创建名为ik的文件夹
mkdir ik
#进入ik
cd ik/
#文件传入该目录下,并解压
unzip elasticsearch-analysis-ik-7.10.2.zip

重启es后验证插件是否安装成功

/home/es/elasticsearch-7.10.2/bin/elasticsearch-plugin list

  • 11
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,下面是安装 Elasticsearch 和 Kibana,并且使用证书连接 Elasticsearch 的步骤: 1. 安装 Elasticsearch 执行以下命令: ``` sudo yum install -y java-1.8.0-openjdk-devel sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch sudo vi /etc/yum.repos.d/elasticsearch.repo ``` 在 elasticsearch.repo 文件中添加以下内容: ``` [elasticsearch-7.x] name=Elasticsearch repository for 7.x packages baseurl=https://artifacts.elastic.co/packages/7.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=1 autorefresh=1 type=rpm-md ``` 保存并退出文件,然后执行以下命令安装 Elasticsearch: ``` sudo yum install -y elasticsearch ``` 2. 配置 Elasticsearch 打开 Elasticsearch 配置文件 /etc/elasticsearch/elasticsearch.yml,设置以下参数: ``` cluster.name: my-cluster node.name: my-node-1 network.host: 0.0.0.0 http.port: 9200 xpack.security.enabled: true xpack.security.http.ssl.enabled: true xpack.security.http.ssl.key: /etc/elasticsearch/elasticsearch.key xpack.security.http.ssl.certificate: /etc/elasticsearch/elasticsearch.crt xpack.security.transport.ssl.enabled: true xpack.security.transport.ssl.key: /etc/elasticsearch/elasticsearch.key xpack.security.transport.ssl.certificate: /etc/elasticsearch/elasticsearch.crt ``` 保存并退出文件,然后执行以下命令启动 Elasticsearch: ``` sudo systemctl enable elasticsearch sudo systemctl start elasticsearch ``` 3. 安装 Kibana 执行以下命令: ``` sudo vi /etc/yum.repos.d/kibana.repo ``` 在 kibana.repo 文件中添加以下内容: ``` [kibana-7.x] name=Kibana repository for 7.x packages baseurl=https://artifacts.elastic.co/packages/7.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=1 autorefresh=1 type=rpm-md ``` 保存并退出文件,然后执行以下命令安装 Kibana: ``` sudo yum install -y kibana ``` 4. 配置 Kibana 打开 Kibana 配置文件 /etc/kibana/kibana.yml,设置以下参数: ``` server.port: 5601 server.host: "0.0.0.0" elasticsearch.hosts: ["https://localhost:9200"] elasticsearch.username: "kibana" elasticsearch.password: "kibanapassword" elasticsearch.ssl.certificateAuthorities: [ "/etc/kibana/ca.crt" ] elasticsearch.ssl.verificationMode: certificate ``` 保存并退出文件,然后执行以下命令启动 Kibana: ``` sudo systemctl enable kibana sudo systemctl start kibana ``` 5. 生成证书 执行以下命令生成证书: ``` cd /etc/elasticsearch sudo /usr/share/elasticsearch/bin/elasticsearch-certutil cert -out elasticsearch.zip sudo unzip elasticsearch.zip sudo mv elasticsearch /etc/kibana/ sudo chown -R kibana:kibana /etc/kibana/elasticsearch ``` 6. 配置权限 执行以下命令给 kibana 用户赋予访问 Elasticsearch 的权限: ``` sudo /usr/share/elasticsearch/bin/elasticsearch-setup-passwords auto ``` 运行上述命令后,会生成一个密码列表,将其中的 kibana 用户的密码记录下来。 7. 配置防火墙规则 执行以下命令打开 5601 和 9200 端口: ``` sudo firewall-cmd --zone=public --add-port=5601/tcp --permanent sudo firewall-cmd --zone=public --add-port=9200/tcp --permanent sudo firewall-cmd --reload ``` 至此,Elasticsearch 和 Kibana 安装和配置完成,并且 Kibana 使用证书连接 Elasticsearch。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值