Compare commits
No commits in common. "a4dbd7f8111ee3d0ebe6ff511baf0c1bd0be2a96" and "49a6f8f956e89fd8cad9dd986bea743f17cebb0c" have entirely different histories.
a4dbd7f811
...
49a6f8f956
@ -1,333 +0,0 @@
|
|||||||
services:
|
|
||||||
zookeeper:
|
|
||||||
image: registry.cn-qingdao.aliyuncs.com/jisheyun/pulsar:4.0.6
|
|
||||||
container_name: zookeeper
|
|
||||||
hostname: zookeeper
|
|
||||||
restart: unless-stopped
|
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
cpus: "2"
|
|
||||||
memory: 2g
|
|
||||||
command: >
|
|
||||||
/bin/bash -c
|
|
||||||
"bin/apply-config-from-env.py conf/zookeeper.conf &&
|
|
||||||
bin/pulsar zookeeper"
|
|
||||||
environment:
|
|
||||||
- PULSAR_MEM=-Xms512m -Xmx512m -Dcom.sun.management.jmxremote -Djute.maxbuffer=10485760
|
|
||||||
ports:
|
|
||||||
- "${PULSAR_ZOOKEEPER_PORT}:${PULSAR_ZOOKEEPER_PORT}"
|
|
||||||
networks:
|
|
||||||
- pulsar-net
|
|
||||||
volumes:
|
|
||||||
- pulsar-zookeeper-data:/pulsar/data/zookeeper
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "bin/pulsar-zookeeper-ruok.sh"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 5
|
|
||||||
start_period: 60s
|
|
||||||
|
|
||||||
pulsar-cluster-init:
|
|
||||||
image: registry.cn-qingdao.aliyuncs.com/jisheyun/pulsar:4.0.6
|
|
||||||
container_name: pulsar-cluster-init
|
|
||||||
hostname: pulsar-cluster-init
|
|
||||||
command: >
|
|
||||||
/bin/bash -c
|
|
||||||
"bin/pulsar initialize-cluster-metadata --cluster pulsar-cluster-1 --zookeeper zookeeper:${PULSAR_ZOOKEEPER_PORT} --configuration-store zookeeper:${PULSAR_ZOOKEEPER_PORT} --web-service-url http://${SERVER_IP}:${PULSAR_ADMIN_PORT} --broker-service-url pulsar://${SERVER_IP}:${PULSAR_BROKER_PORT} || echo 'Cluster metadata already exists'"
|
|
||||||
depends_on:
|
|
||||||
zookeeper:
|
|
||||||
condition: service_healthy
|
|
||||||
networks:
|
|
||||||
- pulsar-net
|
|
||||||
|
|
||||||
bookie:
|
|
||||||
image: registry.cn-qingdao.aliyuncs.com/jisheyun/pulsar:4.0.6
|
|
||||||
container_name: pulsar-bookie
|
|
||||||
hostname: pulsar-bookie
|
|
||||||
restart: unless-stopped
|
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
cpus: "2"
|
|
||||||
memory: 2g
|
|
||||||
command: >
|
|
||||||
/bin/bash -c
|
|
||||||
"bin/apply-config-from-env.py conf/bookkeeper.conf &&
|
|
||||||
(bin/bookkeeper shell metaformat -n --force || echo 'Bookie already formatted') &&
|
|
||||||
bin/pulsar bookie"
|
|
||||||
environment:
|
|
||||||
- PULSAR_MEM=-Xms1g -Xmx1g -XX:MaxDirectMemorySize=1g
|
|
||||||
- BOOKIE_MEM=-Xms1g -Xmx1g -XX:MaxDirectMemorySize=1g
|
|
||||||
- PULSAR_PREFIX_zkServers=zookeeper:${PULSAR_ZOOKEEPER_PORT}
|
|
||||||
depends_on:
|
|
||||||
zookeeper:
|
|
||||||
condition: service_healthy
|
|
||||||
pulsar-cluster-init:
|
|
||||||
condition: service_completed_successfully
|
|
||||||
networks:
|
|
||||||
- pulsar-net
|
|
||||||
volumes:
|
|
||||||
- pulsar-bookkeeper-data:/pulsar/data/bookkeeper
|
|
||||||
|
|
||||||
broker:
|
|
||||||
image: registry.cn-qingdao.aliyuncs.com/jisheyun/pulsar:4.0.6
|
|
||||||
container_name: pulsar-broker
|
|
||||||
hostname: pulsar-broker
|
|
||||||
restart: unless-stopped
|
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
cpus: "2"
|
|
||||||
memory: 2g
|
|
||||||
command: >
|
|
||||||
/bin/bash -c
|
|
||||||
"bin/apply-config-from-env.py conf/broker.conf && bin/pulsar broker"
|
|
||||||
environment:
|
|
||||||
- PULSAR_MEM=-Xms1g -Xmx1g -XX:MaxDirectMemorySize=1g
|
|
||||||
- PULSAR_PREFIX_clusterName=pulsar-cluster-1
|
|
||||||
- PULSAR_PREFIX_zookeeperServers=zookeeper:${PULSAR_ZOOKEEPER_PORT}
|
|
||||||
- PULSAR_PREFIX_configurationStoreServers=zookeeper:${PULSAR_ZOOKEEPER_PORT}
|
|
||||||
- PULSAR_PREFIX_bookkeeperClientPort=3181
|
|
||||||
- PULSAR_PREFIX_brokerServicePort=${PULSAR_BROKER_PORT}
|
|
||||||
- PULSAR_PREFIX_webServicePort=${PULSAR_ADMIN_PORT}
|
|
||||||
- PULSAR_PREFIX_advertisedAddress=${SERVER_IP}
|
|
||||||
- PULSAR_PREFIX_managedLedgerDefaultEnsembleSize=1
|
|
||||||
- PULSAR_PREFIX_managedLedgerDefaultWriteQuorum=1
|
|
||||||
- PULSAR_PREFIX_managedLedgerDefaultAckQuorum=1
|
|
||||||
- PULSAR_PREFIX_allowAutoTopicCreation=true
|
|
||||||
# 启用非持久化主题
|
|
||||||
- PULSAR_PREFIX_enableNonPersistentTopics=true
|
|
||||||
# 基本认证配置
|
|
||||||
- PULSAR_PREFIX_authenticationEnabled=true
|
|
||||||
- PULSAR_PREFIX_authenticationProviders=org.apache.pulsar.broker.authentication.AuthenticationProviderBasic
|
|
||||||
- PULSAR_PREFIX_basicAuthConf=file:///pulsar/auth/.htpasswd
|
|
||||||
# Broker自身的认证配置
|
|
||||||
- PULSAR_PREFIX_brokerClientAuthenticationPlugin=org.apache.pulsar.client.impl.auth.AuthenticationBasic
|
|
||||||
- PULSAR_PREFIX_brokerClientAuthenticationParameters={"userId":"${PULSAR_ADMIN_USER}","password":"${PULSAR_ADMIN_PASSWORD}"}
|
|
||||||
# 授权配置
|
|
||||||
- PULSAR_PREFIX_authorizationEnabled=false
|
|
||||||
- PULSAR_PREFIX_allowAutoTopicCreationType=partitioned
|
|
||||||
- PULSAR_PREFIX_allowAnonymousAccess=false
|
|
||||||
# 非持久化主题特殊配置
|
|
||||||
- PULSAR_PREFIX_allowNonPersistentTopics=true
|
|
||||||
- PULSAR_PREFIX_nonPersistentTopicsEnabled=true
|
|
||||||
ports:
|
|
||||||
- "${PULSAR_BROKER_PORT}:${PULSAR_BROKER_PORT}"
|
|
||||||
- "${PULSAR_ADMIN_PORT}:${PULSAR_ADMIN_PORT}"
|
|
||||||
depends_on:
|
|
||||||
zookeeper:
|
|
||||||
condition: service_healthy
|
|
||||||
bookie:
|
|
||||||
condition: service_started
|
|
||||||
pulsar-cluster-init:
|
|
||||||
condition: service_completed_successfully
|
|
||||||
networks:
|
|
||||||
- pulsar-net
|
|
||||||
volumes:
|
|
||||||
- pulsar-broker-data:/pulsar/data
|
|
||||||
- ./pulsar/auth:/pulsar/auth
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "bin/pulsar-admin", "--admin-url", "http://localhost:${PULSAR_ADMIN_PORT}", "--auth-plugin", "org.apache.pulsar.client.impl.auth.AuthenticationBasic", "--auth-params", '{"userId":"${PULSAR_ADMIN_USER}","password":"${PULSAR_ADMIN_PASSWORD}"}', "clusters", "list"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 5
|
|
||||||
start_period: 60s
|
|
||||||
|
|
||||||
pulsar-init:
|
|
||||||
image: registry.cn-qingdao.aliyuncs.com/jisheyun/pulsar:4.0.6
|
|
||||||
container_name: pulsar-init
|
|
||||||
hostname: pulsar-init
|
|
||||||
command: >
|
|
||||||
/bin/bash -c
|
|
||||||
"
|
|
||||||
# 等待broker就绪
|
|
||||||
until bin/pulsar-admin --admin-url http://pulsar-broker:${PULSAR_ADMIN_PORT} --auth-plugin org.apache.pulsar.client.impl.auth.AuthenticationBasic --auth-params '{\"userId\":\"${PULSAR_ADMIN_USER}\",\"password\":\"${PULSAR_ADMIN_PASSWORD}\"}' clusters list; do
|
|
||||||
echo 'Waiting for Pulsar broker to be ready...'
|
|
||||||
sleep 5
|
|
||||||
done;
|
|
||||||
|
|
||||||
# 创建租户和命名空间
|
|
||||||
bin/pulsar-admin --admin-url http://pulsar-broker:${PULSAR_ADMIN_PORT} --auth-plugin org.apache.pulsar.client.impl.auth.AuthenticationBasic --auth-params '{\"userId\":\"${PULSAR_ADMIN_USER}\",\"password\":\"${PULSAR_ADMIN_PASSWORD}\"}' tenants create public --allowed-clusters pulsar-cluster-1 -r admin || echo 'Tenant public already exists';
|
|
||||||
bin/pulsar-admin --admin-url http://pulsar-broker:${PULSAR_ADMIN_PORT} --auth-plugin org.apache.pulsar.client.impl.auth.AuthenticationBasic --auth-params '{\"userId\":\"${PULSAR_ADMIN_USER}\",\"password\":\"${PULSAR_ADMIN_PASSWORD}\"}' namespaces create public/default || echo 'Namespace public/default already exists';
|
|
||||||
|
|
||||||
# 创建非持久化主题
|
|
||||||
bin/pulsar-admin --admin-url http://pulsar-broker:${PULSAR_ADMIN_PORT} --auth-plugin org.apache.pulsar.client.impl.auth.AuthenticationBasic --auth-params '{\"userId\":\"${PULSAR_ADMIN_USER}\",\"password\":\"${PULSAR_ADMIN_PASSWORD}\"}' topics create non-persistent://public/default/default-topic || echo 'Topic non-persistent://public/default/default-topic already exists';
|
|
||||||
|
|
||||||
# 设置命名空间策略
|
|
||||||
echo 'Setting namespace policies...';
|
|
||||||
bin/pulsar-admin --admin-url http://pulsar-broker:${PULSAR_ADMIN_PORT} --auth-plugin org.apache.pulsar.client.impl.auth.AuthenticationBasic --auth-params '{\"userId\":\"${PULSAR_ADMIN_USER}\",\"password\":\"${PULSAR_ADMIN_PASSWORD}\"}' namespaces set-subscription-types-enabled public/default --types NonDurable;
|
|
||||||
bin/pulsar-admin --admin-url http://pulsar-broker:${PULSAR_ADMIN_PORT} --auth-plugin org.apache.pulsar.client.impl.auth.AuthenticationBasic --auth-params '{\"userId\":\"${PULSAR_ADMIN_USER}\",\"password\":\"${PULSAR_ADMIN_PASSWORD}\"}' namespaces set-message-ttl public/default --messageTTL 0;
|
|
||||||
bin/pulsar-admin --admin-url http://pulsar-broker:${PULSAR_ADMIN_PORT} --auth-plugin org.apache.pulsar.client.impl.auth.AuthenticationBasic --auth-params '{\"userId\":\"${PULSAR_ADMIN_USER}\",\"password\":\"${PULSAR_ADMIN_PASSWORD}\"}' namespaces set-retention public/default --sizeLimit -1 --timeLimit -1;
|
|
||||||
|
|
||||||
echo 'Pulsar initialization completed with Basic Authentication!';
|
|
||||||
"
|
|
||||||
depends_on:
|
|
||||||
broker:
|
|
||||||
condition: service_healthy
|
|
||||||
networks:
|
|
||||||
- pulsar-net
|
|
||||||
|
|
||||||
iotdb-standalone-service:
|
|
||||||
image: registry.cn-qingdao.aliyuncs.com/jisheyun/iotdb:2.0.4-standalone
|
|
||||||
hostname: iotdb-standalone
|
|
||||||
container_name: iotdb-standalone
|
|
||||||
restart: always
|
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
cpus: "8"
|
|
||||||
memory: 16g
|
|
||||||
ports:
|
|
||||||
- "${IOTDB_PORT}:6667"
|
|
||||||
environment:
|
|
||||||
- cn_internal_address=iotdb-standalone
|
|
||||||
- cn_internal_port=10710
|
|
||||||
- cn_consensus_port=10720
|
|
||||||
- cn_seed_config_node=iotdb-standalone:10710
|
|
||||||
- dn_rpc_address=iotdb-standalone
|
|
||||||
- dn_internal_address=iotdb-standalone
|
|
||||||
- dn_rpc_port=6667
|
|
||||||
- dn_internal_port=10730
|
|
||||||
- dn_mpp_data_exchange_port=10740
|
|
||||||
- dn_schema_region_consensus_port=10750
|
|
||||||
- dn_data_region_consensus_port=10760
|
|
||||||
- dn_seed_config_node=iotdb-standalone:10710
|
|
||||||
privileged: true
|
|
||||||
volumes:
|
|
||||||
- ./iotdb/conf:/iotdb/conf
|
|
||||||
- ./iotdb/data:/iotdb/data
|
|
||||||
- ./iotdb/logs:/iotdb/logs
|
|
||||||
networks:
|
|
||||||
- pulsar-net
|
|
||||||
|
|
||||||
redis-service:
|
|
||||||
image: registry.cn-qingdao.aliyuncs.com/jisheyun/redis:8.0.2-alpine3.21
|
|
||||||
container_name: redis
|
|
||||||
restart: always
|
|
||||||
hostname: redis
|
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
cpus: "2.0"
|
|
||||||
memory: 2g
|
|
||||||
ports:
|
|
||||||
- "${REDIS_PORT}:6379"
|
|
||||||
volumes:
|
|
||||||
- ./redis/outdata:/data
|
|
||||||
- ./redis/conf:/etc/redis/conf
|
|
||||||
command: redis-server /etc/redis/conf/redis.conf
|
|
||||||
stdin_open: true
|
|
||||||
tty: true
|
|
||||||
networks:
|
|
||||||
- pulsar-net
|
|
||||||
|
|
||||||
mysql-service:
|
|
||||||
image: registry.cn-qingdao.aliyuncs.com/jisheyun/mysql:8.4.6
|
|
||||||
container_name: mysql
|
|
||||||
hostname: mysql
|
|
||||||
restart: always
|
|
||||||
privileged: true
|
|
||||||
user: "1000:1000" # 使用宿主机用户ID
|
|
||||||
ports:
|
|
||||||
- "${MYSQL_PORT}:3306"
|
|
||||||
environment:
|
|
||||||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
|
||||||
TZ: Asia/Shanghai
|
|
||||||
volumes:
|
|
||||||
- ./mysql/log:/var/log/mysql
|
|
||||||
- ./mysql/data:/var/lib/mysql
|
|
||||||
- ./mysql/init:/docker-entrypoint-initdb.d
|
|
||||||
command:
|
|
||||||
- --character-set-server=utf8mb4
|
|
||||||
- --collation-server=utf8mb4_unicode_ci
|
|
||||||
- --user=mysql # 确保MySQL以mysql用户运行
|
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
cpus: "2.0"
|
|
||||||
memory: 2g
|
|
||||||
stdin_open: true
|
|
||||||
tty: true
|
|
||||||
networks:
|
|
||||||
- pulsar-net
|
|
||||||
|
|
||||||
admin-api-service:
|
|
||||||
image: registry.cn-qingdao.aliyuncs.com/jisheyun/jishe.iot.admin:2025.0901.1107
|
|
||||||
container_name: admin-api
|
|
||||||
hostname: admin-api
|
|
||||||
restart: always
|
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
cpus: "2.0"
|
|
||||||
memory: 4g
|
|
||||||
ports:
|
|
||||||
- "${ADMIN_API_PORT}:10500"
|
|
||||||
volumes:
|
|
||||||
- ./adminapi/conf:/app/configs
|
|
||||||
- ./adminapi/logs:/app/logs
|
|
||||||
stdin_open: true
|
|
||||||
tty: true
|
|
||||||
depends_on:
|
|
||||||
mysql-service:
|
|
||||||
condition: service_started
|
|
||||||
redis-service:
|
|
||||||
condition: service_started
|
|
||||||
iotdb-standalone-service:
|
|
||||||
condition: service_started
|
|
||||||
zookeeper:
|
|
||||||
condition: service_healthy
|
|
||||||
broker:
|
|
||||||
condition: service_healthy
|
|
||||||
networks:
|
|
||||||
- pulsar-net
|
|
||||||
|
|
||||||
admin-web-service:
|
|
||||||
image: registry.cn-qingdao.aliyuncs.com/jisheyun/jishe.iot.ui:2025.0901.1413
|
|
||||||
container_name: admin-web
|
|
||||||
hostname: admin-web
|
|
||||||
restart: always
|
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
cpus: "1.0"
|
|
||||||
memory: 2g
|
|
||||||
ports:
|
|
||||||
- "${ADMIN_WEB_PORT}:8080"
|
|
||||||
stdin_open: true
|
|
||||||
tty: true
|
|
||||||
depends_on:
|
|
||||||
admin-api-service:
|
|
||||||
condition: service_started
|
|
||||||
networks:
|
|
||||||
- pulsar-net
|
|
||||||
|
|
||||||
networks:
|
|
||||||
pulsar-net:
|
|
||||||
driver: bridge
|
|
||||||
ipam:
|
|
||||||
driver: default
|
|
||||||
config:
|
|
||||||
- subnet: 172.23.0.0/16
|
|
||||||
gateway: 172.23.0.1
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
pulsar-zookeeper-data:
|
|
||||||
driver: local
|
|
||||||
driver_opts:
|
|
||||||
type: none
|
|
||||||
o: bind
|
|
||||||
device: ./pulsar/zookeeper-data
|
|
||||||
pulsar-bookkeeper-data:
|
|
||||||
driver: local
|
|
||||||
driver_opts:
|
|
||||||
type: none
|
|
||||||
o: bind
|
|
||||||
device: ./pulsar/bookkeeper-data
|
|
||||||
pulsar-broker-data:
|
|
||||||
driver: local
|
|
||||||
driver_opts:
|
|
||||||
type: none
|
|
||||||
o: bind
|
|
||||||
device: ./pulsar/pulsar-data
|
|
||||||
@ -28,6 +28,19 @@ services:
|
|||||||
retries: 5
|
retries: 5
|
||||||
start_period: 60s
|
start_period: 60s
|
||||||
|
|
||||||
|
pulsar-cluster-init:
|
||||||
|
image: registry.cn-qingdao.aliyuncs.com/jisheyun/pulsar:4.0.6
|
||||||
|
container_name: pulsar-cluster-init
|
||||||
|
hostname: pulsar-cluster-init
|
||||||
|
command: >
|
||||||
|
/bin/bash -c
|
||||||
|
"bin/pulsar initialize-cluster-metadata --cluster pulsar-cluster-1 --zookeeper zookeeper:${PULSAR_ZOOKEEPER_PORT} --configuration-store zookeeper:${PULSAR_ZOOKEEPER_PORT} --web-service-url http://${SERVER_IP}:${PULSAR_ADMIN_PORT} --broker-service-url pulsar://${SERVER_IP}:${PULSAR_BROKER_PORT} || echo 'Cluster metadata already exists'"
|
||||||
|
depends_on:
|
||||||
|
zookeeper:
|
||||||
|
condition: service_healthy
|
||||||
|
networks:
|
||||||
|
- pulsar-net
|
||||||
|
|
||||||
bookie:
|
bookie:
|
||||||
image: registry.cn-qingdao.aliyuncs.com/jisheyun/pulsar:4.0.6
|
image: registry.cn-qingdao.aliyuncs.com/jisheyun/pulsar:4.0.6
|
||||||
container_name: pulsar-bookie
|
container_name: pulsar-bookie
|
||||||
@ -37,10 +50,11 @@ services:
|
|||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: "2"
|
cpus: "2"
|
||||||
memory: 4g
|
memory: 2g
|
||||||
command: >
|
command: >
|
||||||
/bin/bash -c
|
/bin/bash -c
|
||||||
"bin/apply-config-from-env.py conf/bookkeeper.conf &&
|
"bin/apply-config-from-env.py conf/bookkeeper.conf &&
|
||||||
|
(bin/bookkeeper shell metaformat -n --force || echo 'Bookie already formatted') &&
|
||||||
bin/pulsar bookie"
|
bin/pulsar bookie"
|
||||||
environment:
|
environment:
|
||||||
- PULSAR_MEM=-Xms1g -Xmx1g -XX:MaxDirectMemorySize=1g
|
- PULSAR_MEM=-Xms1g -Xmx1g -XX:MaxDirectMemorySize=1g
|
||||||
@ -49,16 +63,12 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
zookeeper:
|
zookeeper:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
pulsar-cluster-init:
|
||||||
|
condition: service_completed_successfully
|
||||||
networks:
|
networks:
|
||||||
- pulsar-net
|
- pulsar-net
|
||||||
volumes:
|
volumes:
|
||||||
- pulsar-bookkeeper-data:/pulsar/data/bookkeeper
|
- pulsar-bookkeeper-data:/pulsar/data/bookkeeper
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "bin/bookkeeper", "shell", "bookiesanity"]
|
|
||||||
interval: 30s
|
|
||||||
timeout: 10s
|
|
||||||
retries: 5
|
|
||||||
start_period: 60s
|
|
||||||
|
|
||||||
broker:
|
broker:
|
||||||
image: registry.cn-qingdao.aliyuncs.com/jisheyun/pulsar:4.0.6
|
image: registry.cn-qingdao.aliyuncs.com/jisheyun/pulsar:4.0.6
|
||||||
@ -69,7 +79,7 @@ services:
|
|||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: "2"
|
cpus: "2"
|
||||||
memory: 4g
|
memory: 2g
|
||||||
command: >
|
command: >
|
||||||
/bin/bash -c
|
/bin/bash -c
|
||||||
"bin/apply-config-from-env.py conf/broker.conf && bin/pulsar broker"
|
"bin/apply-config-from-env.py conf/broker.conf && bin/pulsar broker"
|
||||||
@ -109,7 +119,9 @@ services:
|
|||||||
zookeeper:
|
zookeeper:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
bookie:
|
bookie:
|
||||||
condition: service_healthy
|
condition: service_started
|
||||||
|
pulsar-cluster-init:
|
||||||
|
condition: service_completed_successfully
|
||||||
networks:
|
networks:
|
||||||
- pulsar-net
|
- pulsar-net
|
||||||
volumes:
|
volumes:
|
||||||
@ -122,6 +134,40 @@ services:
|
|||||||
retries: 5
|
retries: 5
|
||||||
start_period: 60s
|
start_period: 60s
|
||||||
|
|
||||||
|
pulsar-init:
|
||||||
|
image: registry.cn-qingdao.aliyuncs.com/jisheyun/pulsar:4.0.6
|
||||||
|
container_name: pulsar-init
|
||||||
|
hostname: pulsar-init
|
||||||
|
command: >
|
||||||
|
/bin/bash -c
|
||||||
|
"
|
||||||
|
# 等待broker就绪
|
||||||
|
until bin/pulsar-admin --admin-url http://pulsar-broker:${PULSAR_ADMIN_PORT} --auth-plugin org.apache.pulsar.client.impl.auth.AuthenticationBasic --auth-params '{\"userId\":\"${PULSAR_ADMIN_USER}\",\"password\":\"${PULSAR_ADMIN_PASSWORD}\"}' clusters list; do
|
||||||
|
echo 'Waiting for Pulsar broker to be ready...'
|
||||||
|
sleep 5
|
||||||
|
done;
|
||||||
|
|
||||||
|
# 创建租户和命名空间
|
||||||
|
bin/pulsar-admin --admin-url http://pulsar-broker:${PULSAR_ADMIN_PORT} --auth-plugin org.apache.pulsar.client.impl.auth.AuthenticationBasic --auth-params '{\"userId\":\"${PULSAR_ADMIN_USER}\",\"password\":\"${PULSAR_ADMIN_PASSWORD}\"}' tenants create public --allowed-clusters pulsar-cluster-1 -r admin || echo 'Tenant public already exists';
|
||||||
|
bin/pulsar-admin --admin-url http://pulsar-broker:${PULSAR_ADMIN_PORT} --auth-plugin org.apache.pulsar.client.impl.auth.AuthenticationBasic --auth-params '{\"userId\":\"${PULSAR_ADMIN_USER}\",\"password\":\"${PULSAR_ADMIN_PASSWORD}\"}' namespaces create public/default || echo 'Namespace public/default already exists';
|
||||||
|
|
||||||
|
# 创建非持久化主题
|
||||||
|
bin/pulsar-admin --admin-url http://pulsar-broker:${PULSAR_ADMIN_PORT} --auth-plugin org.apache.pulsar.client.impl.auth.AuthenticationBasic --auth-params '{\"userId\":\"${PULSAR_ADMIN_USER}\",\"password\":\"${PULSAR_ADMIN_PASSWORD}\"}' topics create non-persistent://public/default/default-topic || echo 'Topic non-persistent://public/default/default-topic already exists';
|
||||||
|
|
||||||
|
# 设置命名空间策略
|
||||||
|
echo 'Setting namespace policies...';
|
||||||
|
bin/pulsar-admin --admin-url http://pulsar-broker:${PULSAR_ADMIN_PORT} --auth-plugin org.apache.pulsar.client.impl.auth.AuthenticationBasic --auth-params '{\"userId\":\"${PULSAR_ADMIN_USER}\",\"password\":\"${PULSAR_ADMIN_PASSWORD}\"}' namespaces set-subscription-types-enabled public/default --types NonDurable;
|
||||||
|
bin/pulsar-admin --admin-url http://pulsar-broker:${PULSAR_ADMIN_PORT} --auth-plugin org.apache.pulsar.client.impl.auth.AuthenticationBasic --auth-params '{\"userId\":\"${PULSAR_ADMIN_USER}\",\"password\":\"${PULSAR_ADMIN_PASSWORD}\"}' namespaces set-message-ttl public/default --messageTTL 0;
|
||||||
|
bin/pulsar-admin --admin-url http://pulsar-broker:${PULSAR_ADMIN_PORT} --auth-plugin org.apache.pulsar.client.impl.auth.AuthenticationBasic --auth-params '{\"userId\":\"${PULSAR_ADMIN_USER}\",\"password\":\"${PULSAR_ADMIN_PASSWORD}\"}' namespaces set-retention public/default --sizeLimit -1 --timeLimit -1;
|
||||||
|
|
||||||
|
echo 'Pulsar initialization completed with Basic Authentication!';
|
||||||
|
"
|
||||||
|
depends_on:
|
||||||
|
broker:
|
||||||
|
condition: service_healthy
|
||||||
|
networks:
|
||||||
|
- pulsar-net
|
||||||
|
|
||||||
iotdb-standalone-service:
|
iotdb-standalone-service:
|
||||||
image: registry.cn-qingdao.aliyuncs.com/jisheyun/iotdb:2.0.4-standalone
|
image: registry.cn-qingdao.aliyuncs.com/jisheyun/iotdb:2.0.4-standalone
|
||||||
hostname: iotdb-standalone
|
hostname: iotdb-standalone
|
||||||
@ -163,8 +209,8 @@ services:
|
|||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: "1.0"
|
cpus: "2.0"
|
||||||
memory: 1g
|
memory: 2g
|
||||||
ports:
|
ports:
|
||||||
- "${REDIS_PORT}:6379"
|
- "${REDIS_PORT}:6379"
|
||||||
volumes:
|
volumes:
|
||||||
@ -214,7 +260,8 @@ services:
|
|||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
memory: 8g
|
cpus: "2.0"
|
||||||
|
memory: 4g
|
||||||
ports:
|
ports:
|
||||||
- "${ADMIN_API_PORT}:10500"
|
- "${ADMIN_API_PORT}:10500"
|
||||||
volumes:
|
volumes:
|
||||||
@ -245,7 +292,7 @@ services:
|
|||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpus: "1.0"
|
cpus: "1.0"
|
||||||
memory: 500mb
|
memory: 2g
|
||||||
ports:
|
ports:
|
||||||
- "${ADMIN_WEB_PORT}:8080"
|
- "${ADMIN_WEB_PORT}:8080"
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
|
|||||||
@ -143,7 +143,27 @@ sleep 10
|
|||||||
# 启动主服务
|
# 启动主服务
|
||||||
echo "第六步:🚀 启动 部署主脚本 ..."
|
echo "第六步:🚀 启动 部署主脚本 ..."
|
||||||
|
|
||||||
docker compose docker-compose-init.yml up -d
|
# 检查是否是Pulsar重启
|
||||||
|
if [ -d "./pulsar/zookeeper-data" ] && [ "$(ls -A ./pulsar/zookeeper-data)" ]; then
|
||||||
|
echo "⚠️ 检测到Pulsar数据目录已存在,可能是重启操作"
|
||||||
|
echo "🧹 清理Pulsar状态数据以确保正常启动..."
|
||||||
|
|
||||||
|
# 停止可能运行的服务
|
||||||
|
docker compose down
|
||||||
|
|
||||||
|
# 清理Pulsar状态数据(保留数据目录)
|
||||||
|
echo "清理Zookeeper状态..."
|
||||||
|
sudo rm -rf ./pulsar/zookeeper-data/*
|
||||||
|
echo "清理BookKeeper状态..."
|
||||||
|
sudo rm -rf ./pulsar/bookkeeper-data/*
|
||||||
|
echo "清理Pulsar broker状态..."
|
||||||
|
sudo rm -rf ./pulsar/pulsar-data/*
|
||||||
|
|
||||||
|
echo "✅ Pulsar状态数据已清理"
|
||||||
|
sleep 5
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker compose up -d
|
||||||
|
|
||||||
# 等待IoTDB启动完成
|
# 等待IoTDB启动完成
|
||||||
echo "⏳ 等待IoTDB服务启动完成..."
|
echo "⏳ 等待IoTDB服务启动完成..."
|
||||||
@ -200,15 +220,4 @@ echo " MySQL: mysql -h ${SERVER_IP} -P ${MYSQL_PORT} -uroot -p${MYSQL_ROOT_PAS
|
|||||||
echo " IoTDB: docker exec -it iotdb-standalone ./start-cli.sh -h iotdb-standalone -u root -p Lixiao@1980"
|
echo " IoTDB: docker exec -it iotdb-standalone ./start-cli.sh -h iotdb-standalone -u root -p Lixiao@1980"
|
||||||
echo ""
|
echo ""
|
||||||
echo "🎯 等待服务启动完成..."
|
echo "🎯 等待服务启动完成..."
|
||||||
echo "⏳ 请等待3分钟让所有服务完全初始化成功"
|
echo "⏳ 请等待几分钟让所有服务完全启动"
|
||||||
sleep 180
|
|
||||||
echo "🎯 服务初始化完成..."
|
|
||||||
echo "⏳ 然后等待1分钟让所有服务完全停止 docker compose docker-compose-init.yml down"
|
|
||||||
|
|
||||||
docker compose docker-compose-init.yml down
|
|
||||||
|
|
||||||
sleep 60
|
|
||||||
echo "🎯 初始化服务已经完成停止......"
|
|
||||||
echo "⏳ 最后再通过 启动最终生产环境,移除初始化依赖,等待服务最终启动完成。"
|
|
||||||
|
|
||||||
docker compose up -d
|
|
||||||
|
|||||||
@ -276,10 +276,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DockerComposeShells", "Dock
|
|||||||
DockerComposeShells\adminapi\conf\appsettings.Development.json = DockerComposeShells\adminapi\conf\appsettings.Development.json
|
DockerComposeShells\adminapi\conf\appsettings.Development.json = DockerComposeShells\adminapi\conf\appsettings.Development.json
|
||||||
DockerComposeShells\adminapi\conf\appsettings.json = DockerComposeShells\adminapi\conf\appsettings.json
|
DockerComposeShells\adminapi\conf\appsettings.json = DockerComposeShells\adminapi\conf\appsettings.json
|
||||||
DockerComposeShells\docker-compose-iotdb-standalone.yml = DockerComposeShells\docker-compose-iotdb-standalone.yml
|
DockerComposeShells\docker-compose-iotdb-standalone.yml = DockerComposeShells\docker-compose-iotdb-standalone.yml
|
||||||
DockerComposeShells\docker-compose-init.yml = DockerComposeShells\docker-compose-init.yml
|
|
||||||
DockerComposeShells\docker-compose.yml = DockerComposeShells\docker-compose.yml
|
DockerComposeShells\docker-compose.yml = DockerComposeShells\docker-compose.yml
|
||||||
DockerComposeShells\mysql\init\init-db.sql = DockerComposeShells\mysql\init\init-db.sql
|
|
||||||
DockerComposeShells\iotdb\init\init-iot-db.sql = DockerComposeShells\iotdb\init\init-iot-db.sql
|
DockerComposeShells\iotdb\init\init-iot-db.sql = DockerComposeShells\iotdb\init\init-iot-db.sql
|
||||||
|
DockerComposeShells\mysql\init\init-db.sql = DockerComposeShells\mysql\init\init-db.sql
|
||||||
DockerComposeShells\redis\conf\redis.conf = DockerComposeShells\redis\conf\redis.conf
|
DockerComposeShells\redis\conf\redis.conf = DockerComposeShells\redis\conf\redis.conf
|
||||||
DockerComposeShells\start-pulsar.sh = DockerComposeShells\start-pulsar.sh
|
DockerComposeShells\start-pulsar.sh = DockerComposeShells\start-pulsar.sh
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user