docker安装elasticsearch

该文介绍了如何在Docker环境下安装Elasticsearch5.6.2,包括调整max_map_count参数、设置单节点集群,以及修改配置文件以允许HTTPCORS和禁用安全认证。此外,还提供了默认账户和密码以及如何通过命令行进入容器进行交互。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

docker安装elasticsearch

# 查看max_map_count的值 默认是65530
cat /proc/sys/vm/max_map_count
# 重新设置max_map_count的值
sysctl -w vm.max_map_count=262144
# 下载ES
docker pull docker.elastic.co/elasticsearch/elasticsearch:5.6.2

运行elasticsearch

docker run --name elasticsearch -d -e ES_JAVA_OPTS="-Xms512m -Xmx512m" -e "discovery.type=single-node" -p 9200:9200 -p 9300:9300 docker.elastic.co/elasticsearch/elasticsearch:5.6.2

ES默认账户:elastic,默认密码:changeme。访问http://192.168.200.133:9200/。

docker exec -it elasticsearch bash


修改es配置文件

 

tee /usr/share/elasticsearch/config/elasticsearch.yml <<-'EOF'
cluster.name: "docker-cluster" # 设置集群的名称
network.host: 0.0.0.0

#http.host: 0.0.0.0
#http.post: 9200
transport.tcp.port: 9300
http.cors.allow-origin: "*"
http.cors.allow-credentials: true
http.cors.enabled: true

# minimum_master_nodes need to be explicitly set when bound on a public IP
# set to 1 to allow single node clusters
# Details: https://github.com/elastic/elasticsearch/pull/17288
discovery.zen.minimum_master_nodes: 1

xpack.security.enabled: false # 关闭密码
node.name: es-node
bootstrap.memory_lock: false #设置 ES 节点允许内存交换
bootstrap.system_call_filter: false #禁用系统调用过滤器

transport.host: 0.0.0.0
network.publish_host: 192.168.200.133
EOF

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值