High Available Usage Deployment

High available usage deployment of Seata depends on registry center, configuration center and database.

Seata-Server

The Seata-Server need registry center, and save transaction data into database, for example, use Nacos

  • Modify configuration in registry.conf
  1. registry {
  2. type = "nacos"
  3. nacos {
  4. application = "seata-server"
  5. serverAddr = "192.168.199.2"
  6. namespace = ""
  7. cluster = "default"
  8. username = ""
  9. password = ""
  10. }
  11. }
  12. config {
  13. type = "nacos"
  14. nacos {
  15. serverAddr = "192.168.199.2"
  16. namespace = ""
  17. group = "SEATA_GROUP"
  18. username = ""
  19. password = ""
  20. }
  21. }
  • Modify configuration in configuration center
  1. service.vgroupMapping.my_test_tx_group=default
  2. store.mode=db
  3. store.db.datasource=druid
  4. store.db.dbType=mysql
  5. store.db.driverClassName=com.mysql.jdbc.Driver
  6. store.db.url=jdbc:mysql://192.168.199.2:30060/seata?useUnicode=true
  7. store.db.user=root
  8. store.db.password=123456
  • Create table global_table, branch_table, lock_table in database

Please reference script on /script/server/db/

Now, startup multiple seata-server, and then the server is support high available usage.


For example, using Kubernetes deploy, the configuration file like:

  1. apiVersion: v1
  2. kind: Service
  3. metadata:
  4. name: seata-ha-server
  5. namespace: default
  6. labels:
  7. app.kubernetes.io/name: seata-ha-server
  8. spec:
  9. type: ClusterIP
  10. ports:
  11. - port: 8091
  12. protocol: TCP
  13. name: http
  14. selector:
  15. app.kubernetes.io/name: seata-ha-server
  16. ---
  17. apiVersion: apps/v1
  18. kind: Deployment
  19. metadata:
  20. name: seata-ha-server
  21. namespace: default
  22. labels:
  23. app.kubernetes.io/name: seata-ha-server
  24. spec:
  25. replicas: 3
  26. selector:
  27. matchLabels:
  28. app.kubernetes.io/name: seata-ha-server
  29. template:
  30. metadata:
  31. labels:
  32. app.kubernetes.io/name: seata-ha-server
  33. spec:
  34. containers:
  35. - name: seata-ha-server
  36. image: apache/seata-server:2.1.0
  37. imagePullPolicy: IfNotPresent
  38. env:
  39. - name: SEATA_CONFIG_NAME
  40. value: file:/root/seata-config/registry
  41. ports:
  42. - name: http
  43. containerPort: 8091
  44. protocol: TCP
  45. volumeMounts:
  46. - name: seata-config
  47. mountPath: /root/seata-config
  48. volumes:
  49. - name: seata-config
  50. configMap:
  51. name: seata-ha-server-config
  52. ---
  53. apiVersion: v1
  54. kind: ConfigMap
  55. metadata:
  56. name: seata-ha-server-config
  57. data:
  58. registry.conf: |
  59. registry {
  60. type = "nacos"
  61. nacos {
  62. application = "seata-server"
  63. serverAddr = "192.168.199.2"
  64. }
  65. }
  66. config {
  67. type = "nacos"
  68. nacos {
  69. serverAddr = "192.168.199.2"
  70. group = "SEATA_GROUP"
  71. }
  72. }

You can reference seata-ha-deploy-practice for more detail about practice of HA deploy.