首页 > 其他分享 >k8s安装seata单机版

k8s安装seata单机版

时间:2024-04-17 17:12:10浏览次数:32  
标签:单机版 seata t1 server conf k8s zdbl name

1.初始seata数据库

wget  https://raw.githubusercontent.com/apache/incubator-seata/1.3.0/script/server/db/mysql.sql
mysql -uroot -p
CREATE DATABASE IF NOT EXISTS t1_zdbl_seata DEFAULT CHARSET utf8mb4 COLLATE utf8mb4_general_ci;
use t1_zdbl_seata;
source  /root/mysql.sql;
CREATE USER 't1_zdbl_seata'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON t1_zdbl_seata.* TO 't1_zdbl_seata'@'%';
FLUSH PRIVILEGES;
exit;

2.创建seata配置文件

registry.conf

apiVersion: v1
kind: ConfigMap
metadata:
  name: t1-zdbl-seata-server-registry-config
  namespace: t1-zdbl
data:
  registry.conf: |
    registry {
        type = "nacos"
        nacos {
          application = "seata-server"
          serverAddr = "t1-zdbl-nacos.t1-zdbl.svc.cluster.local:8848"
          group = "SEATA_GROUP"
          namespace = "seata"
          cluster = "default"
          username = "nacos"
          password = "m5LqrxYsD7N1F6Cb"
        }
    }
    config {
      type = "file"
      file {
            name = "file:/seata-server/resources/file.conf"
          }
    }

file.conf

apiVersion: v1
kind: ConfigMap
metadata:
  name: t1-zdbl-seata-server-file-config
  namespace: t1-zdbl
data:
  file.conf: |
    store {
        mode = "db"    
        db {
           datasource = "druid"
           dbType = "mysql"
           driverClassName = "com.mysql.cj.jdbc.Driver"
           url = "jdbc:mysql://t1-zdbl-mysql.t1-zdbl.svc.cluster.local:3306/t1_zdbl_seata?useUnicode=true&characterEncoding=UTF-8"
           user = "t1_zdbl_seata"
           password = "xxxxx"  #连接nacos的密码不能包含特殊字符,否则会报错,403无法注册
           minConn = 5
           maxConn = 100
           globalTable = "global_table"
           branchTable = "branch_table"
           lockTable = "lock_table"
           queryLimit = 100
           maxWait = 5000
        }
    }

3.创建部署文件

apiVersion: apps/v1
kind: Deployment
metadata:
  name: t1-zdbl-seata-server
  namespace: t1-zdbl
  labels:
    k8s-app: t1-zdbl-seata-server
spec:
  replicas: 1
  selector:
    matchLabels:
      k8s-app: t1-zdbl-seata-server
  template:
    metadata:
      labels:
        k8s-app: t1-zdbl-seata-server
    spec:
      containers:
        - name: seata-server
          image: seataio/seata-server:1.3.0
          #command: ["/bin/sh","-c","sleep 3600000"]
          env:
            - name: SEATA_PORT
              value: "8091"
          ports:
            - name: http
              containerPort: 8091
              protocol: TCP
          volumeMounts:
          - mountPath: /seata-server/resources/file.conf
            name: seata-file-conf
            subPath: file.conf
          - mountPath: /seata-server/resources/registry.conf
            name: seata-register-conf
            subPath: registry.conf
      volumes:
      - name: seata-file-conf
        configMap:
          defaultMode: 420
          name: t1-zdbl-seata-server-file-config
      - name: seata-register-conf
        configMap:
          defaultMode: 420
          name: t1-zdbl-seata-server-registry-config

4.创建svc文件

apiVersion: v1
kind: Service
metadata:
  name: t1-zdbl-seata-server
  namespace: t1-zdbl
  labels:
    k8s-app: t1-zdbl-seata-server
spec:
  ports:
    - port: 8091
      targetPort: 8091
      protocol: TCP
      name: http
  selector:
    k8s-app: t1-zdbl-seata-server

初始化数据库后,应用以上文件即可

 

标签:单机版,seata,t1,server,conf,k8s,zdbl,name
From: https://www.cnblogs.com/panwenbin-logs/p/18141245

相关文章

  • k8s更新证书
    环境操作系统:centos7.9.2009集群架构:三个节点,一主两从,k8s版本v1.21.5,kubesphere安装的集群,应该算是kubeadm部署的集群ip:192.168.106.130,192.168.106.131,192.168.106.132集群状态:3个节点证书过期,全都挂掉这是我2022年在虚拟机装的集群,现在时间是2024年3月29日报错信息[root......
  • k8s证书
    查看证书过期时间kubeadmcertscheck-expiration更新证书kubeadmcertsrenewall也可以更新单个证书更新apiserver证书kubeadmcertsrenewapiserver更新apiserver-etcd-client证书kubeadmcertsrenewapiserver-etcd-client更新apiserver-kubelet-client证书......
  • k8s安装rabbbitmq
    1.创建rabbitmqpvc文件kind:PersistentVolumeClaimapiVersion:v1metadata:name:rabbitmq-datanamespace:t1-zdblspec:storageClassName:nfs-client#如果使用存储类自行替换,不是按具体情况配置accessModes:-ReadWriteManyresources:requests......
  • k8s快速创建MongoDB
    1.创建MongoDBpvc文件如果不需要持久存储可以忽略kind:PersistentVolumeClaimapiVersion:v1metadata:name:mongodb-datanamespace:t1-zdblspec:storageClassName:nfs-client#这里使用的存储类accessModes:-ReadWriteManyresources:reques......
  • 基于K8s+Docker+Openresty+Lua+SpringCloudAlibaba的高并发秒杀系统——与京东淘宝同
    ​介绍基于K8s+Docker+Openresty+Lua+SpringCloudAlibaba的高并发高性能商品秒杀系统,本系统实测单台(16核32G主频2.2GHz)openresty(nginx)的QPS可高达6w并发,如果您需要应对100w的并发,则需要100w/6w=17台openresty服务器,17台服务器同时接收并处理这100w的并发流量呢?当然是商业......
  • 自建一款现代化的K8s可视化管理系统
    自建一款现代化的K8s可视化管理系统原创 院长技术 院长技术 2024-03-0107:30 北京 3人听过院长简介作者:院长职位:运维开发工程师官网:https://deanit.cn博客:https://blog.deanit.cn擅长:【虚拟化,容器化,自动化运维,CICD,监控,日志,中间件,双机热备,分布式存储,数据库,认......
  • k8s之ExternalName使用
    一、简介externalNameService是k8s中一个特殊的service类型,它不需要指定selector去选择哪些pods实例提供服务,而是使用DNSCNAME机制把自己CNAME到你指定的另外一个域名上,你可以提供集群内的名字,比如mysql.db.svc这样的建立在db命名空间内的mysql服务,也可以指定http://mysql.exam......
  • k8s之容器运行时
    Kubernetes中的容器运行时容器运行时(ContainerRuntime)是Kubernetes最重要的组件之一,负责真正管理镜像和容器的生命周期。Kubelet通过ContainerRuntimeInterface(CRI)与容器运行时交互,以管理镜像和容器。​ 容器运行时接口(ContainerRuntimeInterface(CRI))是Kube......
  • 用k8s的networkpolicy模拟租户隔离、组间pod隔离
    pod之间的通信默认是不隔离的,他们之是能相互通信的,但如果你想通过IP地址或者端口来管理网络通信,那么就可以使用k8s的networkpolicy功能。该功能的实现原理是默认都不通过,显示添加白名单。如果指定namespace,那么该networkpolicy生效的范围是本namespace内。如果没有指定namespace,......
  • k8s资深工程师必备技能
    Kubernetes核心概念和技术:节点、容器、Pod、控制器、服务、部署、卷等。高级容器编排:滚动更新、回滚、扩缩容、故障恢复、自愈等。Kubernetes网络模型:CNI插件、Service、Ingress、NetworkPolicy等。Kubernetes存储模型:Volume、PV、PVC、CSI等。Kubernetes安全:RBAC、ServiceAc......