安装mysql
mkdir /opt/mysql /opt/mysql/etc /opt/mysql/data docker run -itd --name mariadb -e MYSQL_ROOT_PASSWORD=123456 -p 3306:3306 -v $(pwd)/mysql/etc/my.cnf:/etc/mysql/my.cnf -v $(pwd)/mysql/data:/var/lib/mysql mariadb:10.5.4
配置文件
# [client] default-character-set = utf8mb4 [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock log-error = /var/lib/mysql/mysql_error.log log-queries-not-using-indexes = 1 slow-query-log = 1 slow-query-log-file = /var/lib/mysql/mysql_slow.log #skip-grant-tables # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Settings user and group are ignored when systemd is used. # If you need to run mysqld under a different user or group, # customize your systemd unit file for mariadb according to the # instructions in http://fedoraproject.org/wiki/Systemd sql-mode='NO_ENGINE_SUBSTITUTION' init-connect = 'SET NAMES utf8mb4' character-set-server = utf8mb4 server-id = 1 log_bin=/var/lib/mysql/mysql-bin log_bin_index=/var/lib/mysql/mysql-bin.index expire-logs-days = 7 sync-binlog = 1 # SAFETY # max-allowed-packet = 1024M max-connect-errors = 1000000 # CACHES AND LIMITS # tmp-table-size = 32M max-heap-table-size = 32M query-cache-type = 0 query-cache-size = 0 max-connections = 1500 thread-cache-size = 50 open-files-limit = 65535 table-definition-cache = 4096 table-open-cache = 4096 # INNODB # innodb-flush-method = O_DIRECT innodb-log-files-in-group = 2 innodb-log-file-size = 512M innodb-flush-log-at-trx-commit = 1 innodb-file-per-table = 1 innodb-buffer-pool-size = 3G innodb_lock_wait_timeout = 500 [mysqld_safe] log-error=/var/log/mariadb/mariadb.log pid-file=/var/run/mariadb/mariadb.pid # # include all files from the config directory # !includedir /etc/mysql/conf.d/ !includedir /etc/mysql/mariadb.conf.d/
安装mongodb
mkdir /opt/mongodb/data /opt/mongodb/etc /opt/mongodb/logs docker run -itd --rm -v /opt/mongodb/data:/data/db -v /opt/mongodb/etc:/etc/mongo -v /opt/mongodb/logs:/var/log/mongodb -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=admin -p 27017:27017 mongo:4.2.8 --config /etc/mongo/mongod.conf
配置文件
# # where to write logging data. systemLog: destination: file logAppend: true path: /var/log/mongodb/mongod.log # Where and how to store data. storage: dbPath: /data/db journal: enabled: true directoryPerDB: true # engine: # mmapv1: # wiredTiger: # how the process runs processManagement: # fork: true # fork and run in background # pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile timeZoneInfo: /usr/share/zoneinfo # network interfaces net: port: 27017 bindIp: 0.0.0.0 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting. #security: security: authorization: enabled # keyFile: /data1/mongodb/keyfile #operationProfiling: #sharding: ## Enterprise-Only Options #auditLog: #snmp:
安装redis
docker run -itd -v /opt/redis/etc/redis.conf:/usr/local/etc/redis/redis.conf -v /opt/redis/data/:/data -p 6379:6379 redis:5.0.9 redis-server /usr/local/etc/redis/redis.conf
配置文件
bind 0.0.0.0 protected-mode yes port 6379 tcp-backlog 511 timeout 0 tcp-keepalive 300 daemonize no supervised no pidfile /var/run/redis_6379.pid loglevel notice logfile "/data/redis.log" databases 16 always-show-logo yes save 900 1 save 300 10 save 60 10000 stop-writes-on-bgsave-error yes rdbcompression yes rdbchecksum yes dbfilename dump.rdb dir ./ replica-serve-stale-data yes replica-read-only yes repl-diskless-sync no repl-diskless-sync-delay 5 repl-disable-tcp-nodelay no replica-priority 100 requirepass admin@2020 lazyfree-lazy-eviction no lazyfree-lazy-expire no lazyfree-lazy-server-del no replica-lazy-flush no appendonly no appendfilename "appendonly.aof" appendfsync everysec no-appendfsync-on-rewrite no auto-aof-rewrite-percentage 100 auto-aof-rewrite-min-size 64mb aof-load-truncated yes aof-use-rdb-preamble yes lua-time-limit 5000 slowlog-log-slower-than 10000 slowlog-max-len 128 latency-monitor-threshold 0 notify-keyspace-events "" hash-max-ziplist-entries 512 hash-max-ziplist-value 64 list-max-ziplist-size -2 list-compress-depth 0 set-max-intset-entries 512 zset-max-ziplist-entries 128 zset-max-ziplist-value 64 hll-sparse-max-bytes 3000 stream-node-max-bytes 4096 stream-node-max-entries 100 activerehashing yes client-output-buffer-limit normal 0 0 0 client-output-buffer-limit replica 256mb 64mb 60 client-output-buffer-limit pubsub 32mb 8mb 60 hz 10 dynamic-hz yes aof-rewrite-incremental-fsync yes rdb-save-incremental-fsync yes
安装rabbitmq
docker run -itd --rm --hostname rabbitmq-server -v /opt/rabbitmq:/var/lib/rabbitmq -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=rabbitmq@admin -p 15672:15672 -p 5672:5672 rabbitmq:3.8.5-management
gitea&&gogs
docker run -itd -e USER_UID=1000 -e USER_GID=1000 -v /opt/gitea:/data -v /etc/timezone:/etc/timezone:ro -v /etc/localtime:/etc/localtime:ro -p 3000:3000 -p 222:22 --restart=always gitea/gitea:latest
zookeeper
mkdir /data/zookeeper /data/zookeeper/conf /data/zookeeper/data chmod 777 /data/zookeeper/data docker run -itd -p 2181:2181 -e ALLOW_ANONYMOUS_LOGIN=yes --name zookeeper -v $(pwd)/data:/bitnami/zookeeper/data -v $(pwd)/conf/zoo.cfg:/opt/bitnami/zookeeper/conf/zoo.cfg bitnami/zookeeper:3.6.2
配置
tickTime=2000 initLimit=10 syncLimit=5 dataDir=/bitnami/zookeeper/data clientPort=2181 maxClientCnxns=60 autopurge.snapRetainCount=3 autopurge.purgeInterval=1
kafka
docker run -itd --name kafka --restart always --net host -p 9092:9092 -e ALLOW_PLAINTEXT_LISTENER=yes -e KAFKA_CFG_ZOOKEEPER_CONNECT=xx.xx:2181 -e KAFKA_BROKER_ID=1 -e KAFKA_LISTENERS=PLAINTEXT://xx:9092 -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://xx:9092 -v $(pwd)/data:/bitnami/kafka/data bitnami/kafka:2.6.0
redis
docker run -itd --name redis --rm --net host -p 6379:6379 -e ALLOW_EMPTY_PASSWORD=yes -v /data/redis/data:/bitnami/redis/data bitnami/redis:latest docker run -idt --rm --name redis-sentinel -p 26379:26379 --net host -e REDIS_MASTER_HOST=172.16.xx.xx bitnami/redis-sentinel:latest
clickhouse
docker run -itd --rm --name clickhouse-server -p 9004:9004 -p 8123:8123 -p 9000:9000 --ulimit nofile=262144:262144 -v $(pwd)/conf/config.xml:/etc/clickhouse-server/config.xml --volume=$(pwd)/data:/var/lib/clickhouse yandex/clickhouse-server:20.6.10.2