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