当前位置: 首页 > article >正文

Docker安装ElasticSearch8.9.0

安装ElasticSearch8.9.0

预先配置

1.在centos虚拟机中,修改配置sysctl.conf
vim /etc/sysctl.conf
2.加入配置
vm.max_map_count=262144 
3.启用配置
sysctl -p
注:这一步是为了防止启动容器时,报出如下错误:
bootstrap checks failed max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]

拉取镜像运行elasticsearch

1.dockerhub 拉取镜像
docker pull elasticsearch:8.9.0
2.查看docker镜像
docker images
3.创建网桥
 docker network create es
4.运行docker镜像
docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 --network es -v esdata:/usr/share/elasticsearch/data -v esconfig:/usr/share/elasticsearch/config -v esplungs:/usr/share/elasticsearch/plugins -e "discovery.type=single-node" 镜像id

问题解决

问题1:启动失败无法访问9200
1.查看日志
docker logs -f 容器id
"log.level": "WARN", "message":"received plaintext http traffic on an https channel, closing connection Netty4HttpChannel
2.需要修改配置文件elasticsearch.yml
原因是开启了ssl,需要修改为如下配置
xpack.security.http.ssl:
 	enabled: false
3.重启容器
docker restart 容器id
问题2:需要输入密码
1.修改配置文件 elasticsearch.yml
xpack.security.enabled: true
xpack.license.self_generated.type: basic
xpack.security.transport.ssl.enabled: true
2.进入容器自行设置密码

[root@localhost _data]# docker exec -it 容器id bash
elasticsearch@a3cda7fb5558:~$ cd /bin
elasticsearch@a3cda7fb5558:/bin$ elasticsearch-setup-passwords interactive


Note: The ‘elasticsearch-setup-passwords’ tool has been deprecated. This command will be removed in a future release.


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

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]

3.重启容器
docker restart 容器id
问题1和问题2修改后的配置文件
cluster.name: "docker-cluster"
network.host: 0.0.0.0
#----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------
#
# The following settings, TLS certificates, and keys have been automatically      
# generated to configure Elasticsearch security features on 07-02-2024 01:44:33
#
# --------------------------------------------------------------------------------
# Enable security features
xpack.security.enabled: true
xpack.license.self_generated.type: basic
xpack.security.enrollment.enabled: true

# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
  enabled: false
  keystore.path: certs/http.p12

# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
  enabled: true
  verification_mode: certificate
  keystore.path: certs/transport.p12
  truststore.path: certs/transport.p12
#----------------------- END SECURITY AUTO CONFIGURATION -------------------------

安装分词器

1.下载分词器
wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v8.9.0/elasticsearch-analysis-ik-8.9.0.zip
2.查看数据卷位置
docker volume inspect esplungs
3.创建ik文件夹,并将压缩文件解压
/var/lib/docker/volumes/esplungs/_data/ik
4.重启容器
docker restart 容器id

http://www.kler.cn/a/231830.html

相关文章:

  • Excel单元格中自适应填充多图
  • 爬虫——Requests库的使用
  • 大数据如何助力干部选拔的公正性
  • 21.3D surface
  • Rewar Model的输出(不包含训练)
  • Excel超级处理器:高效实现2种批量生成二维码方式
  • 【buuctf--被偷走的文件】
  • 美赛结束后,还可以转学术论文发表!
  • 编码技巧——在项目中使用Alibaba Cloud Toolkit远程部署
  • Wireshark不显示Thrift协议
  • 开源活动汇集网站
  • C#面:Property 和 Attribute 它们各有什么作用
  • Linux系统安装(CentOS Vmware)
  • 字节3面真题,LeetCode上hard难度,极具启发性题解
  • Rust 初体验2
  • 容器库(6)-std::set
  • Codeforces Round 260 (Div. 1)A. Boredom(dp)
  • springboot172基于springboot的二手车交易系统的设计与实现
  • Rust开发WASM,WASM Runtime运行
  • 蓝桥杯-求阶乘-python
  • elk之search API
  • Apollo2.2.0 arm 达梦 人大金仓 适配
  • 华为认证 | 2024了,华为HCIA还有必要考?
  • CSS 控制 video 标签的控制栏组件的显隐
  • C语言实现网络爬虫
  • 【C++】C++的简要介绍