Redis

Redis 集群 Docker docker-compose.yml services: redis: image: redis:7.4.0 container_name: redis volumes: - /etc/localtime:/etc/localtime:ro - /opt/redis/conf:/usr/local/etc/redis - /opt/redis/data:/data environment: - TZ=Asia/Shanghai command: - redis-server - /usr/local/etc/redis/redis.conf network_mode: host restart: always redis.conf bind 0.0.0.0 port 6379 appendonly yes loglevel notice cluster-enabled yes cluster-config-file nodes.conf cluster-node-timeout 5000 cluster-announce-ip x.x.x.x 启动 docker compose -f docker-compose.yml up -d 添加节点 redis-cli --cluster create 192.168.26.11:6379 192.168.26.12:6379 192.168.26.13:6379 192.168.26.14:6379 192.168.26.15:6379 192.168.26.16:6379 192.168.26.17:6379 192.168.26.18:6379 --cluster-replicas 1 docker exec -it redis redis-cli CLUSTER MEET x....

August 8, 2024 · Kevin

Kafka

Kafka Kafka 需要配合 Zookeeper HOSTNAME IP node1 192.168.2.11 node2 192.168.2.12 Docker node1 docker-compose.yml services: zookeeper: image: zookeeper:3.7.2 container_name: zookeeper volumes: - /etc/localtime:/etc/localtime:ro - /opt/zookeeper/conf:/conf - /opt/zookeeper/data:/data - /opt/zookeeper/logs:/datalog environment: - TZ=Asia/Shanghai - ZOO_MY_ID=1 network_mode: host restart: always kafka: image: docker.io/bitnami/kafka:3.3.2 container_name: kafka volumes: - /etc/localtime:/etc/localtime - /opt/kafka/conf:/opt/bitnami/kafka/config - /mnt/da/kafka/data:/bitnami/kafka environment: - TZ=Asia/Shanghai - KAFKA_BROKER_ID=1 - KAFKA_CFG_LISTENERS=PLAINTEXT://:9091 - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://node-1:9091 - KAFKA_CFG_ZOOKEEPER_CONNECT=node-1:2181,node-2:2181 - ALLOW_PLAINTEXT_LISTENER=yes network_mode: host restart: always depends_on: - zookeeper 获取 zookeeper 配置...

July 25, 2024 · Kevin

Minio

Minio HOSTNAME IP node1 192.168.2.11 node2 192.168.2.12 Docker node1 docker-compose.yml services: minio: image: minio/minio:RELEASE.2024-06-13T22-53-53Z container_name: minio volumes: - /etc/localtime:/etc/localtime:ro - /var/run/docker.sock:/var/run/docker.sock - /mnt/da/minio/data1:/data1 - /mnt/db/minio/data2:/data2 environment: - TZ=Asia/Shanghai - MINIO_ROOT_USER=minio - MINIO_ROOT_PASSWORD=minio command: server http://node-{1...2}/data{1...2} --console-address ":19000" network_mode: host restart: always 启动 docker compose -f docker-compose.yml up -d node2 重复 node1

July 25, 2024 · Kevin

Nacos

Nacos HOSTNAME IP node1 192.168.2.11 node2 192.168.2.12 Docker node1 docker-compose.yml services: nacos: image: nacos/nacos-server:v2.3.2 container_name: nacos env_file: - /opt/nacos/conf/nacos.env volumes: - /etc/localtime:/etc/localtime:ro - /opt/nacos/conf:/home/nacos/conf - /opt/nacos/logs:/home/nacos/logs network_mode: host restart: always 获取 nacos 配置 从临时的容器中复制出来 临时容器名称 xxx 随机通过 docker ps 查看 docker run -it --entrypoint bash nacos/nacos-server:v2.3.2 docker cp xxx:/home/nacos/conf /opt/nacos nacos.env PREFER_HOST_MODE=hostname MODE=cluster # standalone 单机模式 cluster 集群 NACOS_SERVERS="node-1:8848 node-2:8848" SPRING_DATASOURCE_PLATFORM=mysql MYSQL_SERVICE_HOST=node-17 MYSQL_SERVICE_PORT=3316 MYSQL_SERVICE_DB_NAME=nacos MYSQL_SERVICE_USER=root MYSQL_SERVICE_PASSWORD=xxx 初始化数据库 启动 docker compose -f docker-compose....

July 25, 2024 · Kevin

Postgres

Postgres 主从模式 HOSTNAME IP master 192.168.2.11 replica 192.168.2.12 Docker master 创建目录赋权 mkdir -p /mnt/da/postgres/data chown 1000:1000 /mnt/da/postgres/data docker-compose.yml services: postgres: image: timescale/timescaledb-ha:pg16.3-ts2.15.1-all container_name: postgres volumes: - /etc/localtime:/etc/localtime:ro - /mnt/da/postgres/data:/var/lib/postgresql/data environment: - TZ=Asia/Shanghai - PGDATA=/var/lib/postgresql/data/pgdata - POSTGRES_PASSWORD=postgres network_mode: host restart: always 启动 docker compose -f docker-compose.yml up -d 修改 postgresql.conf listen_addresses = '*' max_connections = 1024 password_encryption = scram-sha-256 shared_buffers = 32GB work_mem = 8192kB maintenance_work_mem = 32GB effective_io_concurrency = 512 max_worker_processes = 256 max_parallel_workers_per_gather = 128 max_parallel_workers = 64 wal_level = replica synchronous_commit = off checkpoint_completion_target = 0....

July 25, 2024 · Kevin