version: '3.7'
services:
redis:
image: redis
container_name: redis
command:
- /bin/bash
- -c
- redis-server /etc/redis/redis.conf --requirepass "yourpassword"
restart: always
ports:
- 6379:6379
network_mode: host
volumes:
- ./redis.conf:/etc/redis/redis.conf
- ./data:/data
redis.conf 文件内容
requirepass dobell #daemonize yes bind 0.0.0.0 appendonly yes安装 MongoDB docker-compose.yml 文件内容
version: '3'
services:
mongo:
image: mongo
container_name: mongo
hostname: mongo
restart: always
ports:
- "27017:27017"
environment:
TZ: Asia/Shanghai
MONGO_INITDB_DATAbase: test
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: yourpassword
volumes:
- /etc/localtime:/etc/localtime
- ./data:/data/db
command: mongod
安装 ElasticSearch
docker-compose.yml 文件内容
version: "3.7"
services:
elasticsearch:
image: elasticsearch:7.16.2
container_name: es
deploy:
resources:
limits:
memory: 2G
ports:
- '9200:9200'
- '9300:9300'
volumes:
- ./elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
- ./data:/usr/share/elasticsearch/data
- ./logs:/usr/share/elasticsearch/logs
environment:
- discovery.type=single-node
- ES_JAVA_OPTS=-Xms1024m -Xmx1024m
- TZ=Asia/Shanghai
- TAKE_FILE_OWNERSHIP=true
elasticsearch.yml 文件内容
network.host: 0.0.0.0 node.name: node-1 discovery.zen.ping.unicast.hosts: ["0.0.0.0"] http.cors.enabled: true http.cors.allow-origin: "*" xpack.security.enabled: true xpack.security.audit.enabled: true xpack.license.self_generated.type: basic xpack.security.transport.ssl.enabled: true设置密码
docker exec -it es bash elasticsearch-setup-passwords interactive安装ik分词器
./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.8.4/elasticsearch-analysis-ik-6.8.4.zip



