swarm
This commit is contained in:
38
docker-swarm/nacos/standalone-derby.yml
Normal file
38
docker-swarm/nacos/standalone-derby.yml
Normal file
@ -0,0 +1,38 @@
|
||||
version: '3.8'
|
||||
|
||||
networks:
|
||||
default:
|
||||
name: ${NAMESPACE}
|
||||
external: true
|
||||
services:
|
||||
server:
|
||||
hostname: ${NAMESPACE}_nacos_server
|
||||
image: nacos/nacos-server:${NACOS_VERSION}
|
||||
environment:
|
||||
- PREFER_HOST_MODE=hostname
|
||||
- NACOS_SERVER_IP=${NACOS_SERVER_IP}
|
||||
- MODE=standalone
|
||||
- NACOS_AUTH_ENABLE=true
|
||||
- NACOS_AUTH_IDENTITY_KEY=bndmsdsad
|
||||
- NACOS_AUTH_IDENTITY_VALUE=wepqweq#dasld
|
||||
- NACOS_AUTH_TOKEN=SecretKey012345678901234567890123456587012345678901234567890123456789
|
||||
ports:
|
||||
- target: 8848
|
||||
published: ${NODE_PORT}
|
||||
protocol: tcp
|
||||
mode: host # 解析:默认是ingress就是通过swarm的负载均衡模式,无论通过集群节点的映射端口都能访问到业务容器,此种方式类似于k8s的NodePort的svc服务暴露方式,而host则属于,业务容器运行在哪个节点,则就通过节点地址+映射端口访问对应的业务容器。
|
||||
- target: 9848
|
||||
published: ${NODE_PORT_2}
|
||||
protocol: tcp
|
||||
mode: host
|
||||
volumes:
|
||||
- data_server:/home/nacos/
|
||||
deploy:
|
||||
update_config:
|
||||
order: stop-first
|
||||
placement:
|
||||
constraints:
|
||||
- node.labels.${NAMESPACE}_nacos_server==1
|
||||
volumes:
|
||||
data_server:
|
||||
driver: local
|
Reference in New Issue
Block a user