Kevin的百科

记录与分享

Netcat

Netcat 安装 apt install netcat-openbsd IPv6 nc -6 通过域名测试端口 1-100 3 秒超时 nc -vz -w 3 smilx.cn 1-100 通过 ip 测试端口 1-100 3 秒超时 nc -vnz -w 3 192.168.2.1 1-100 TCP 聊天 服务端 nc -vl 666 客户端 nc -vn 192.168.2.1 666 UDP 聊天 服务端 nc -vlu 666 客户端 nc -vnu 192.168.2.1 666 TCP 传输文件 服务端 nc -vl 666 < test.txt 客户端 nc -vn 192.168.2.1 666 > text.txt

September 30, 2024 · Kevin

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

Docker

Dcoker 设置代理 新建目录和配置 mkdir -p /etc/systemd/system/docker.service.d nano /etc/systemd/system/docker.service.d/http-proxy.conf 添加如下内容 [Service] Environment=HTTP_PROXY=http://192.168.2.11:99 Environment=HTTPS_PROXY=http://192.168.2.11:99 重启 docker systemctl daemon-reload systemctl restart docker 构建不同平台镜像 安装 buildx 设置带有代理的构建环境,代理的 ip 可以通过 ip a 命令查看 docker0 的 ip 一般是 172.17.0.1 docker run --privileged --rm tonistiigi/binfmt --install all docker buildx create --name mybuilder --bootstrap --use --driver-opt env.https_proxy=172.17.0.1:99 --driver-opt env.http_proxy=172.17.0.1:99 打包脚本 build.sh #!/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin docker buildx build --no-cache --platform linux/amd64,linux/arm64 -f Dockerfile -t liwei19920307/vlmcsd:latest . --push 打包命令 chmod a+x ....

May 5, 2023 · 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