docker安装elasticsearch

1、docker search elasticsearch

NAME DESCRIPTION STARS OFFICIAL AUTOMATED

elasticsearch Elasticsearch is a powerful open source sear… 4896 [OK]

nshou/elasticsearch-kibana Elasticsearch-7.10.1 Kibana-7.10.1 125 [OK]

itzg/elasticsearch Provides an easily configurable Elasticsearc… 71 [OK]

elastichq/elasticsearch-hq Official Docker image for ElasticHQ: Elastic… 70 [OK]

mobz/elasticsearch-head elasticsearch-head front-end and standalone … 70

elastic/elasticsearch The Elasticsearch Docker image maintained by… 46

bitnami/elasticsearch Bitnami Docker Image for Elasticsearch 38 [OK]

taskrabbit/elasticsearch-dump Import and export tools for elasticsearch 27 [OK]

 

2、docker pull elasticsearch

Using default tag: latest

latest: Pulling from library/elasticsearch

05d1a5232b46: Pull complete

5cee356eda6b: Pull complete

89d3385f0fd3: Pull complete

65dd87f6620b: Pull complete

78a183a01190: Pull complete

1a4499c85f97: Pull complete

2c9d39b4bfc1: Pull complete

1b1cec2222c9: Pull complete

59ff4ce9df68: Pull complete

1976bc3ee432: Pull complete

5af49e8af381: Pull complete

42c8b75ff7af: Pull complete

7e6902915254: Pull complete

99853874fa54: Pull complete

596fbad6fcff: Pull complete

Digest: sha256:a8081d995ef3443dc6d077093172a5931e02cdb8ffddbf05c67e01d348a9770e

Status: Downloaded newer image for elasticsearch:latest

docker.io/library/elasticsearch:latest

 

3、docker images

REPOSITORY TAG IMAGE ID CREATED SIZE

mysql latest c8562eaf9d81 7 weeks ago 546MB

redis latest 621ceef7494a 2 months ago 104MB

elasticsearch latest 5acf0e8da90b 2 years ago 486MB

 

 

4、创建目录

mkdir -p /home/elasticsearch/config

mkdir -p /home/elasticsearch/data

echo "http.host: 0.0.0.0">>/home/elasticsearch/config/elasticsearch.yml

注:http:host: 0.0.0.0冒号后有一空格

 

5、赋权

chmod -R 777 /home/elasticsearch

 

6、命令启动

docker run --name fbelasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms64m -Xmx128m" -v /home/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /home/elasticsearch/data:/usr/share/elasticsearch/data -v /home/elasticsearch/plugins:/usr/share/elasticsearch/plugins -d elasticsearch

 

7、docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

a4ffc386cc68 elasticsearch "/docker-entrypoint.…" About a minute ago Up About a minute 0.0.0.0:9200->9200/tcp, 9300/tcp fbelasticsearch

 

8、远程访问验证

浏览器:192.168.1.253:9200

 

9、启动容器自启

docker update elasticsearch --restart=always

 

 

第二种启动方式:

docker-compose启动

version: '2' services: elasticsearch: container_name: elasticsearch image: elasticsearch:7.7.0 ports: - "9200:9200" volumes: - /mydata/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml - /mydata/elasticsearch/data:/usr/share/elasticsearch/data - /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins environment: - "ES_JAVA_OPTS=-Xms64m -Xmx128m" - "discovery.type=single-node" - "COMPOSE_PROJECT_NAME=elasticsearch-server" restart: always

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值