dxlance11 commented on issue #7361: URL: https://github.com/apache/incubator-seata/issues/7361#issuecomment-2918237942
> > 同问,似乎只有raft集群模式可以实现 > > 有试验过吗? 解决问题了哥们,有几个问题需要注意,2.3.0有 > > 同问,似乎只有raft集群模式可以实现 > > 有试验过吗? 兄弟我这测试成功了,发个测试环境的参考给你。注意点: 1. 2.3.0的客户端有bug,服务端可以用2.3.0,客户端用2.2.0 2. k8s部署raft集群时不能使用容器的默认启动命令,要用一个python脚本等待DNS解析,也就是等k8s的service分配好IP后才行。 3. 参考容器启动args参数需要把服务名和namespace信息加上 export SEATA_IP=$(HOST_NAME).seata-server.seata ``` --- apiVersion: v1 kind: ConfigMap metadata: name: seata-server-config namespace: seata data: application.yml: | server: port: 7091 spring: application: name: seata-server logging: config: classpath:logback-spring.xml file: path: ${log.home:${user.home}/logs/seata} seata: server: raft: group: default server-addr: seata-server-0.seata-server.seata:9091,seata-server-1.seata-server.seata:9091,seata-server-2.seata-server.seata:9091 snapshot-interval: 600 apply-batch: 32 max-append-bufferSize: 262144 max-replicator-inflight-msgs: 256 disruptor-buffer-size: 16384 election-timeout-ms: 1000 reporter-enabled: false reporter-initial-delay: 60 serialization: jackson compressor: none sync: true config: type: file registry: type: file store: mode: raft file: dir: /seata/sessionStore max-branch-session-size: 16384 max-global-session-size: 512 file-write-buffer-cache-size: 16384 session-reload-read-size: 100 flush-disk-mode: async security: secretKey: SeataSecretKey0c382ef121d778043159209298fd40bf3850a017 tokenValidityInMilliseconds: 1800000 ignore: urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.jpeg,/**/*.ico,/api/v1/auth/login,/version.json,/metadata/v1/** --- apiVersion: v1 kind: Service metadata: name: seata-server namespace: seata labels: app.kubernetes.io/name: seata-server spec: type: ClusterIP clusterIP: None # 设置为Headless Service ports: - port: 8091 protocol: TCP targetPort: 8091 name: http - port: 7091 protocol: TCP targetPort: 7091 name: web - port: 9091 protocol: TCP targetPort: 9091 name: raft selector: app.kubernetes.io/name: seata-server --- apiVersion: apps/v1 kind: StatefulSet metadata: name: seata-server namespace: seata labels: app.kubernetes.io/name: seata-server spec: serviceName: seata-server replicas: 3 selector: matchLabels: app.kubernetes.io/name: seata-server template: metadata: labels: app.kubernetes.io/name: seata-server spec: containers: - name: seata-server image: docker.io/apache/seata-server:2.3.0.jdk21 imagePullPolicy: IfNotPresent command: - /bin/bash args: - '-c' - "export SEATA_IP=$(HOST_NAME).seata-server.seata;python3 -c \"\n\nimport time\nimport socket\n\nprint('Waiting $SEATA_IP to be resolved...')\nwhile True:\n\ttry:\n\t\tip = socket.gethostbyname('$SEATA_IP')\n\t\tprint('Resolve $SEATA_IP to', ip)\n\texcept:\n\t\tprint('Cannot resolve $SEATA_IP, wait 2 seconds', flush=True)\n\t\ttime.sleep(2)\n\t\tcontinue\n\texit(0)\n\n\";/bin/bash /seata-server-entrypoint.sh;" env: - name: TZ value: Asia/Shanghai - name: HOST_NAME valueFrom: fieldRef: apiVersion: v1 fieldPath: metadata.name - name: store.mode value: raft - name: server.port value: '7091' - name: server.servicePort value: '8091' - name: server.raft.serverAddr value: seata-server-0.seata-server.seata:9091,seata-server-1.seata-server.seata:9091,seata-server-2.seata-server.seata:9091 - name: console.user.username value: seata - name: console.user.password value: '123456' ports: - name: http containerPort: 8091 protocol: TCP - name: console containerPort: 7091 protocol: TCP - name: raft containerPort: 9091 protocol: TCP volumeMounts: - mountPath: /seata-server/resources/application.yml name: seata-config subPath: application.yml - name: seata-data mountPath: /seata/sessionStore volumes: - name: seata-config configMap: name: seata-server-config volumeClaimTemplates: - metadata: name: seata-data spec: accessModes: ["ReadWriteOnce"] resources: requests: storage: 10Gi storageClassName: local-hostpath ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org For additional commands, e-mail: notifications-h...@seata.apache.org