Mysql(MGR)和ProxySQL搭建部署-Kubernetes版本

一、Mysql(MGR)

1.1 statefulSet.yaml

apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app: mysql
  name: mysql
  namespace: yihuazt
spec:
  replicas: 3
  serviceName: mysql-headless
  selector:
       matchLabels:
         app: mysql
  template:
    metadata:
      labels:
        app: mysql
    spec:
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: app
                operator: In
                values:
                - mysql
            topologyKey: "kubernetes.io/hostname"
      containers:
      - name: mysql
        image: registry.harbor.com:30002/yihuazt/mysql:8.0.28
        resources:
          requests:
            cpu: "1"
            memory: "1024Mi"
        volumeMounts:
          - name: mysql-data
            mountPath: /var/lib/mysql/
          - name: mysql-cm
            mountPath: /etc/mysql/my.cnf
            subPathExpr: $(POD_NAME).cnf
          - name: mysql-cm
            mountPath: /docker-entrypoint-initdb.d/init.sql
            subPath: init.sql
          - name: mysql-cm
            mountPath: /var/lib/mysql-files/proxysql.sql
            subPath: proxysql.sql
        ports:
          - containerPort: 3306
          - containerPort: 24901
        env:
          - name: TZ
            value: "Asia/Shanghai"
          - name: MYSQL_ROOT_PASSWORD
            valueFrom:
              secretKeyRef:
                name: mysql-cert
                key: password
          - name: POD_IP
            valueFrom:
              fieldRef:
                apiVersion: v1
                fieldPath: status.podIP
          - name: POD_NAME
            valueFrom:
              fieldRef:
                apiVersion: v1
                fieldPath: metadata.name
      volumes:
        - name: mysql-cm
          configMap:
           name: mysql-cm
           items:
           - key: mysql-0.cnf
             path: mysql-0.cnf
           - key: mysql-1.cnf
             path: mysql-1.cnf
           - key: mysql-2.cnf
             path: mysql-2.cnf
           - key: init.sql
             path: init.sql
           - key: proxysql.sql
             path: proxysql.sql
  volumeClaimTemplates:
  - metadata:
      name: mysql-data
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 100Gi
      storageClassName: yihuazt-nfs
      volumeMode: Filesystem

1.2 service.yaml

apiVersion: v1
kind: Service
metadata:
  name: mysql-headless
  namespace: yihuazt
spec:
  ports:
    - name: mysql
      protocol: TCP
      port: 3306
      targetPort: 3306
    - name: mgr
      protocol: TCP
      port: 24901
      targetPort: 24901
  selector:
    app: mysql
  clusterIP: None
  type: ClusterIP

1.3 configMap.yaml

注意:

# 用于限制哪些 IP 地址或 IP 网段可以与 Group Replication 集群进行通信,由于k8s部署Pod是不同网段,跨网段的 MySQL 实例进行 Group Replication必须配置参数,指定哪些 IP 地址或子网允许连接

  • loose-group_replication_ip_whitelist='10.244.0.0/16'

# 用于设置主机名(hostname)的配置参数。这个参数通常用于配置 MySQL Replication 环境中的主机名。如果未配置,MGR集群主机名与无头服务DNS不匹配,通讯失败。

  • report_host=mysql-1.mysql-headless.yihuazt.svc.cluster.local

# server_id一定不能设置为0

  • server_id=1
apiVersion: v1
kind: ConfigMap
metadata:
  name: mysql-cm
  namespace: yihuazt
  labels:
    app: mysql
data:
  mysql-0.cnf: |
    # Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
    #
    # This program is free software; you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation; version 2 of the License.
    #
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License
    # along with this program; if not, write to the Free Software
    # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA

    #
    # The MySQL  Server configuration file.
    #
    # For explanations see
    # http://dev.mysql.com/doc/mysql/en/server-system-variables.html

    [mysqld]
    pid-file        = /var/run/mysqld/mysqld.pid
    socket          = /var/run/mysqld/mysqld.sock
    datadir         = /var/lib/mysql
    secure-file-priv= NULL

    # Custom config should go here
    !includedir /etc/mysql/conf.d/
    default_authentication_plugin=mysql_native_password
    plugin_dir=/usr/lib/mysql/plugin
    server_id=1
    gtid_mode=ON
    enforce_gtid_consistency=ON
    binlog_checksum=NONE
    transaction_write_set_extraction=XXHASH64
    loose-group_replication_recovery_use_ssl=ON
    loose-group_replication_group_name="bbbbbbbb-bbbb-cccc-dddd-eeeeeeeeeeee"
    loose-group_replication_start_on_boot=OFF
    loose-group_replication_local_address="mysql-0.mysql-headless.yihuazt.svc.cluster.local:24901"
    loose-group_replication_group_seeds="mysql-0.mysql-headless.yihuazt.svc.cluster.local:24901,mysql-1.mysql-headless.yihuazt.svc.cluster.local:24901,mysql-2.mysql-headless.yihuazt.svc.cluster.local:24901"
    loose-group_replication_bootstrap_group=OFF
    loose-group_replication_ip_whitelist='10.244.0.0/16'
    report_host=mysql-0.mysql-headless.yihuazt.svc.cluster.local
  mysql-1.cnf: |
    # Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
    #
    # This program is free software; you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation; version 2 of the License.
    #
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License
    # along with this program; if not, write to the Free Software
    # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA

    #
    # The MySQL  Server configuration file.
    #
    # For explanations see
    # http://dev.mysql.com/doc/mysql/en/server-system-variables.html

    [mysqld]
    pid-file        = /var/run/mysqld/mysqld.pid
    socket          = /var/run/mysqld/mysqld.sock
    datadir         = /var/lib/mysql
    secure-file-priv= NULL

    # Custom config should go here
    !includedir /etc/mysql/conf.d/
    default_authentication_plugin=mysql_native_password
    plugin_dir=/usr/lib/mysql/plugin
    server_id=2
    gtid_mode=ON
    enforce_gtid_consistency=ON
    binlog_checksum=NONE
    loose-group_replication_recovery_get_public_key=ON
    loose-group_replication_recovery_use_ssl=ON
    loose-group_replication_group_name="bbbbbbbb-bbbb-cccc-dddd-eeeeeeeeeeee"
    loose-group_replication_start_on_boot=OFF
    loose-group_replication_local_address="mysql-1.mysql-headless.yihuazt.svc.cluster.local:24901"
    loose-group_replication_group_seeds="mysql-0.mysql-headless.yihuazt.svc.cluster.local:24901,mysql-1.mysql-headless.yihuazt.svc.cluster.local:24901,mysql-2.mysql-headless.yihuazt.svc.cluster.local:24901"
    loose-group_replication_bootstrap_group=OFF
    loose-group_replication_ip_whitelist='10.244.0.0/16'
    report_host=mysql-1.mysql-headless.yihuazt.svc.cluster.local
  mysql-2.cnf: |
    # Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
    #
    # This program is free software; you can redistribute it and/or modify
    # it under the terms of the GNU General Public License as published by
    # the Free Software Foundation; version 2 of the License.
    #
    # This program is distributed in the hope that it will be useful,
    # but WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # GNU General Public License for more details.
    #
    # You should have received a copy of the GNU General Public License
    # along with this program; if not, write to the Free Software
    # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA

    #
    # The MySQL  Server configuration file.
    #
    # For explanations see
    # http://dev.mysql.com/doc/mysql/en/server-system-variables.html

    [mysqld]
    pid-file        = /var/run/mysqld/mysqld.pid
    socket          = /var/run/mysqld/mysqld.sock
    datadir         = /var/lib/mysql
    secure-file-priv= NULL

    # Custom config should go here
    !includedir /etc/mysql/conf.d/
    default_authentication_plugin=mysql_native_password
    plugin_dir=/usr/lib/mysql/plugin
    server_id=3
    gtid_mode=ON
    enforce_gtid_consistency=ON
    binlog_checksum=NONE
    loose-group_replication_recovery_get_public_key=ON
    loose-group_replication_recovery_use_ssl=ON
    loose-group_replication_group_name="bbbbbbbb-bbbb-cccc-dddd-eeeeeeeeeeee"
    loose-group_replication_start_on_boot=OFF
    loose-group_replication_local_address="mysql-2.mysql-headless.yihuazt.svc.cluster.local:24901"
    loose-group_replication_group_seeds="mysql-0.mysql-headless.yihuazt.svc.cluster.local:24901,mysql-1.mysql-headless.yihuazt.svc.cluster.local:24901,mysql-2.mysql-headless.yihuazt.svc.cluster.local:24901"
    loose-group_replication_bootstrap_group=OFF
    loose-group_replication_ip_whitelist='10.244.0.0/16'
    report_host=mysql-2.mysql-headless.yihuazt.svc.cluster.local
  init.sql: |
    CREATE USER rpl_user@'%' IDENTIFIED BY 'asAS123456!';
    GRANT REPLICATION SLAVE ON *.* TO rpl_user@'%';
    FLUSH PRIVILEGES;
    RESET MASTER;
    INSTALL PLUGIN group_replication SONAME 'group_replication.so';
    /*
    SELECT * FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME = 'group_replication' \G;
    */
    CHANGE MASTER TO MASTER_USER="rpl_user", MASTER_PASSWORD="asAS123456!" FOR CHANNEL 'group_replication_recovery';
    /*
    SET GLOBAL group_replication_bootstrap_group=ON;
    START GROUP_REPLICATION;
    SET GLOBAL group_replication_bootstrap_group=OFF;

    SELECT * FROM performance_schema.replication_group_members;
    */
  proxysql.sql: |
    /*
    mysql -uroot -prootmcafee123 < /var/lib/mysql-files/proxysql.sql
    */
    use sys;
    DELIMITER $$
    CREATE USER 'monitor'@'%' IDENTIFIED BY "monitor@1025";
    CREATE USER 'proxysql'@'%' IDENTIFIED BY "proxysql@1025";
    GRANT ALL PRIVILEGES ON *.* TO 'monitor'@'%' ;
    GRANT ALL PRIVILEGES ON *.* TO 'proxysql'@'%' ;
    FLUSH PRIVILEGES;
    CREATE FUNCTION my_id() RETURNS TEXT(36) DETERMINISTIC NO SQL RETURN (SELECT @@global.server_uuid as my_id);$$
    CREATE FUNCTION gr_member_in_primary_partition()
        RETURNS VARCHAR(3)
        DETERMINISTIC
        BEGIN
          RETURN (SELECT IF( MEMBER_STATE='ONLINE' AND ((SELECT COUNT(*) FROM
        performance_schema.replication_group_members WHERE MEMBER_STATE NOT IN ('ONLINE', 'RECOVERING')) >=
        ((SELECT COUNT(*) FROM performance_schema.replication_group_members)/2) = 0),
        'YES', 'NO' ) FROM performance_schema.replication_group_members JOIN
        performance_schema.replication_group_member_stats USING(member_id) where member_id=my_id());
    END$$
    CREATE VIEW gr_member_routing_candidate_status AS SELECT
    sys.gr_member_in_primary_partition() as viable_candidate,
    IF( (SELECT (SELECT GROUP_CONCAT(variable_value) FROM
    performance_schema.global_variables WHERE variable_name IN ('read_only',
    'super_read_only')) != 'OFF,OFF'), 'YES', 'NO') as read_only,
    Count_Transactions_Remote_In_Applier_Queue as transactions_behind, Count_Transactions_in_queue as 'transactions_to_cert'
    from performance_schema.replication_group_member_stats where member_id=my_id();$$

1.4 secret.yml

echo -n "rootmcafee123" | base64
echo "cm9vdG1jYWZlZTEyMw==" | base64 --decode

apiVersion: v1
kind: Secret
metadata:
  name: mysql-cert
  namespace: yihuazt
type: Opaque
data:
  password: cm9vdG1jYWZlZTEyMw==

二、ProxySQL

2.1 deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: proxysql
  namespace: yihuazt
spec:
  replicas: 1
  selector:
    matchLabels:
      app: proxysql
  template:
    metadata:
      labels:
        app: proxysql
    spec:
      containers:
        - name: proxysql
          image: registry.harbor.com:30002/yihuazt/proxysql:2.6.5
          ports:
            - containerPort: 6033
            - containerPort: 6032
            - containerPort: 6070
          env:
          - name: TZ
            value: "Asia/Shanghai"
          volumeMounts:
            - name: proxysql-data
              mountPath: /var/lib/proxysql
            - name: proxysql-config
              mountPath: /etc/proxysql.cnf
              subPath: proxysql.cnf
      volumes:
        - name: proxysql-config
          configMap:
              name: proxysql-cm
              items:
              - key: proxysql.cnf
                path: proxysql.cnf
        - name: proxysql-data
          persistentVolumeClaim:
            claimName: proxysql-pvc

2.2 service.yaml

apiVersion: v1
kind: Service
metadata:
  name: proxysql
  namespace: yihuazt
spec:
  selector:
    app: proxysql
  type: NodePort
  ports:
  - port: 6033
    targetPort: 6033
    nodePort: 30633
    name: external

2.3 persistentVolumeClaim.yaml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: proxysql-pvc
  namespace: yihuazt
spec:
  storageClassName: "yihuazt-nfs"
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 30Gi

2.4 configMap.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: proxysql-cm
  namespace: yihuazt
  labels:
    app: proxysql
data:
  proxysql.cnf: |
    #file proxysql.cfg

    ########################################################################################
    # This config file is parsed using libconfig , and its grammar is described in:        
    # http://www.hyperrealm.com/libconfig/libconfig_manual.html#Configuration-File-Grammar 
    # Grammar is also copied at the end of this file                                       
    ########################################################################################

    ########################################################################################
    # IMPORTANT INFORMATION REGARDING THIS CONFIGURATION FILE:                             
    ########################################################################################
    # On startup, ProxySQL reads its config file (if present) to determine its datadir. 
    # What happens next depends on if the database file (disk) is present in the defined
    # datadir (i.e. "/var/lib/proxysql/proxysql.db").
    #
    # If the database file is found, ProxySQL initializes its in-memory configuration from 
    # the persisted on-disk database. So, disk configuration gets loaded into memory and 
    # then propagated towards the runtime configuration. 
    #
    # If the database file is not found and a config file exists, the config file is parsed 
    # and its content is loaded into the in-memory database, to then be both saved on-disk 
    # database and loaded at runtime.
    #
    # IMPORTANT: If a database file is found, the config file is NOT parsed. In this case
    #            ProxySQL initializes its in-memory configuration from the persisted on-disk
    #            database ONLY. In other words, the configuration found in the proxysql.cnf
    #            file is only used to initial the on-disk database read on the first startup.
    #
    # In order to FORCE a re-initialise of the on-disk database from the configuration file 
    # the ProxySQL service should be started with "systemctl start proxysql-initial".
    #
    ########################################################################################

    datadir="/var/lib/proxysql"
    errorlog="/var/lib/proxysql/proxysql.log"

    admin_variables=
    {
      admin_credentials="admin:admin"
    #	mysql_ifaces="127.0.0.1:6032;/tmp/proxysql_admin.sock"
      mysql_ifaces="0.0.0.0:6032"
    #	refresh_interval=2000
    #	debug=true
    }

    mysql_variables=
    {
      threads=4
      max_connections=2048
      default_query_delay=0
      default_query_timeout=36000000
      have_compress=true
      poll_timeout=2000
    #	interfaces="0.0.0.0:6033;/tmp/proxysql.sock"
      interfaces="0.0.0.0:6033"
      default_schema="information_schema"
      stacksize=1048576
      server_version="8.0.28 (ProxySQL)"
      connect_timeout_server=3000
    # make sure to configure monitor username and password
    # https://github.com/sysown/proxysql/wiki/Global-variables#mysql-monitor_username-mysql-monitor_password
      monitor_username="monitor"
      monitor_password="monitor@1025"
      monitor_history=600000
      monitor_connect_interval=60000
      monitor_ping_interval=10000
      monitor_read_only_interval=1500
      monitor_read_only_timeout=500
      ping_interval_server_msec=120000
      ping_timeout_server=500
      commands_stats=true
      sessions_sort=true
      connect_retries_on_failure=10
    }


    # defines all the MySQL servers
    mysql_servers =
    (
    #	{
    #		address = "127.0.0.1" # no default, required . If port is 0 , address is interpred as a Unix Socket Domain
    #		port = 3306           # no default, required . If port is 0 , address is interpred as a Unix Socket Domain
    #		hostgroup = 0	        # no default, required
    #		status = "ONLINE"     # default: ONLINE
    #		weight = 1            # default: 1
    #		compression = 0       # default: 0
    #   max_replication_lag = 10  # default 0 . If greater than 0 and replication lag passes such threshold, the server is shunned
    #	},
    #	{
    #		address = "/var/lib/mysql/mysql.sock"
    #		port = 0
    #		hostgroup = 0
    #	},
    #	{
    #		address="127.0.0.1"
    #		port=21891
    #		hostgroup=0
    #		max_connections=200
    #	},
    #	{ address="127.0.0.2" , port=3306 , hostgroup=0, max_connections=5 },
    #	{ address="127.0.0.1" , port=21892 , hostgroup=1 },
    #	{ address="127.0.0.1" , port=21893 , hostgroup=1 }
    #	{ address="127.0.0.2" , port=3306 , hostgroup=1 },
    #	{ address="127.0.0.3" , port=3306 , hostgroup=1 },
    #	{ address="127.0.0.4" , port=3306 , hostgroup=1 },
    #	{ address="/var/lib/mysql/mysql.sock" , port=0 , hostgroup=1 }
        { address="mysql-0.mysql-headless.yihuazt.svc.cluster.local" , port=3306 , hostgroup=10 },  
        { address="mysql-1.mysql-headless.yihuazt.svc.cluster.local" , port=3306 , hostgroup=10 },  
        { address="mysql-2.mysql-headless.yihuazt.svc.cluster.local" , port=3306 , hostgroup=10 }
    )


    # defines all the MySQL users
    mysql_users:
    (
    #	{
    #		username = "username" # no default , required
    #		password = "password" # default: ''
    #		default_hostgroup = 0 # default: 0
    #		active = 1            # default: 1
    #	},
    #	{
    #		username = "root"
    #		password = ""
    #		default_hostgroup = 0
    #		max_connections=1000
    #		default_schema="test"
    #		active = 1
    #	},
    #	{ username = "user1" , password = "password" , default_hostgroup = 0 , active = 0 }
        {
            username = "proxysql"
            password = "proxysql@1025"
        active = 1
            default_hostgroup = 10
        transaction_persistent = 1
        }
    )



    #defines MySQL Query Rules
    mysql_query_rules:
    (
    #	{
    #		rule_id=1
    #		active=1
    #		match_pattern="^SELECT .* FOR UPDATE$"
    #		destination_hostgroup=0
    #		apply=1
    #	},
    #	{
    #		rule_id=2
    #		active=1
    #		match_pattern="^SELECT"
    #		destination_hostgroup=1
    #		apply=1
    #	}
        {
        rule_id=1
        active=1
        match_digest="^SELECT.*FOR UPDATE$"
        destination_hostgroup=10
        apply=1
      },
      {
        rule_id=2
        active=1
        match_digest="^SELECT"
        destination_hostgroup=30
        apply=1
      }
    )

    scheduler=
    (
    #  {
    #    id=1
    #    active=0
    #    interval_ms=10000
    #    filename="/var/lib/proxysql/proxysql_galera_checker.sh"
    #    arg1="0"
    #    arg2="0"
    #    arg3="0"
    #    arg4="1"
    #    arg5="/var/lib/proxysql/proxysql_galera_checker.log"
    #  }
    )


    mysql_replication_hostgroups=
    (
    #        {
    #                writer_hostgroup=30
    #                reader_hostgroup=40
    #                comment="test repl 1"
    #       },
    #       {
    #                writer_hostgroup=50
    #                reader_hostgroup=60
    #                comment="test repl 2"
    #        }
    )

    mysql_group_replication_hostgroups=
    (
            {
                    writer_hostgroup=10
            backup_writer_hostgroup=20
                    reader_hostgroup=30
            offline_hostgroup=40
            active=1
            max_writers=1
            writer_is_also_reader=0
            max_transactions_behind=100
            }
    )




    # http://www.hyperrealm.com/libconfig/libconfig_manual.html#Configuration-File-Grammar
    #
    # Below is the BNF grammar for configuration files. Comments and include directives are not part of the grammar, so they are not included here. 
    #
    # configuration = setting-list | empty
    #
    # setting-list = setting | setting-list setting
    #     
    # setting = name (":" | "=") value (";" | "," | empty)
    #     
    # value = scalar-value | array | list | group
    #     
    # value-list = value | value-list "," value
    #     
    # scalar-value = boolean | integer | integer64 | hex | hex64 | float
    #                | string
    #     
    # scalar-value-list = scalar-value | scalar-value-list "," scalar-value
    #     
    # array = "[" (scalar-value-list | empty) "]"
    #     
    # list = "(" (value-list | empty) ")"
    #     
    # group = "{" (setting-list | empty) "}"
    #     
    # empty =

运行方法与Docker部署一致,差异性的地方已经说明

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/946140.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

软件测试——面试八股文(入门篇)

今天给大家分享软件测试面试题入门篇&#xff0c;看看大家能答对几题 一、 请你说一说测试用例的边界 参考回答&#xff1a; 边界值分析法就是对输入或输出的边界值进行测试的一种黑盒测试方法。通常边界值分析法是作为对等价类划分法的补充&#xff0c;这种情况下&#xff…

面试场景题系列:设计指标监控和告警系统

在本文中&#xff0c;我们将探讨可扩展的指标监控和告警系统的设计。理解基础设施的状况对维持其可用性和可靠性至关重要。 图-1展示了一些市面上最流行的商用和开源的指标监控和告警服务。 图-1 1.场景边界界定 为了便于展开设计以及考虑通用性&#xff0c;监控和告警需求如…

Spring实现输出带动态标签的日志

版权说明&#xff1a; 本文由博主keep丶原创&#xff0c;转载请保留此块内容在文首。 原文地址&#xff1a; https://blog.csdn.net/qq_38688267/article/details/144851857 文章目录 背景底层原理实现方案Tag缓存实现封装注解通过AOP实现日志缓存封装行为参数通用方法实现手动…

1月第一讲:WxPython跨平台开发框架之前后端结合实现附件信息的上传及管理

1、功能描述和界面 前端&#xff08;wxPython GUI&#xff09;&#xff1a; 提供文件选择、显示文件列表的界面。支持上传、删除和下载附件。展示上传状态和附件信息&#xff08;如文件名、大小、上传时间&#xff09;。后端&#xff08;REST API 服务&#xff09;&#xff1a…

微服务SpringCloud分布式事务之Seata

视频教程&#xff1a;https://www.bilibili.com/video/BV16P63Y3ESq 效果演示 准备的微服务项目调用的链路如下&#xff1a; 文字描述&#xff1a; gateway模块接收到请求&#xff0c;并发送到order订单模块order订单模块接收到请求&#xff0c;新增一个订单数据后发送一个…

Solon 加入 GitCode:助力国产 Java 应用开发新飞跃

在当今数字化快速发展的时代&#xff0c;Java 应用开发框架不断演进&#xff0c;开发者们始终在寻找更快、更小、更简单的解决方案。近期&#xff0c;Solon 正式加入 GitCode&#xff0c;为广大 Java 开发者带来全新的开发体验&#xff0c;尤其是在国产应用开发进程中&#xff…

[实用指南]如何将视频从iPhone传输到iPad

概括 将视频从 iPhone 传输到 iPad 时遇到问题&#xff1f;您可能知道一种方法&#xff0c;但不知道如何操作。此外&#xff0c;您要传输的视频越大&#xff0c;完成任务就越困难。那么如何将视频从 iPhone 传输到 iPad&#xff0c;特别是当您需要发送大视频文件时&#xff1f…

【一起python】银行管理系统

文章目录 &#x1f4dd;计算机基础概念&#x1f320; 导入模块&#x1f320;定义input_card_info函数&#x1f320; 定义check_password函数&#x1f320;初始化用户字典和欢迎信息&#x1f309; 主循环&#x1f309;开户操作&#x1f309;查询操作&#x1f309;取款操作&#…

20241218-信息安全理论与技术复习题

20241218-信息安全理论与技术复习题 一、习题1 信息安全的基本属性是&#xff08;D )。 A、机密性 B、可用性 C、完整性 D、上面 3 项都是 “会话侦听和劫持技术” 是属于&#xff08;B&#xff09;的技术。 A、 密码分析还原 B、 协议漏洞渗透 C、 应用漏洞分析与渗透 D、 D…

音视频入门基础:MPEG2-PS专题(2)——使用FFmpeg命令生成ps文件

一、错误的命令 通过FFmpeg命令可以将mp4文件转换为ps文件&#xff0c;PS文件中包含PS流数据。 由于PS流/PS文件对应的FFInputFormat结构为&#xff1a; const FFInputFormat ff_mpegps_demuxer {.p.name "mpeg",.p.long_name NULL_IF_CONFIG_SMALL…

Unity is running as administrator解决办法

每次打开Unity项目都会有这个弹窗 解决办法&#xff1a; 打开本地安全策略 - 安全选项 &#xff0c;把 用户账户控制&#xff1a;以管理员批准模式运行所有管理员 用户账户控制&#xff1a;用于内置管理员账户的管理员批准模式 改成已启用就行

活动预告 |【Part1】Microsoft Azure 在线技术公开课:数据基础知识

课程介绍 参加“Azure 在线技术公开课&#xff1a;数据基础知识”活动&#xff0c;了解有关云环境和数据服务中核心数据库概念的基础知识。通过本次免费的介绍性活动&#xff0c;你将提升在关系数据、非关系数据、大数据和分析方面的技能。 活动时间&#xff1a;01 月 07 日…

SQL-leetcode-183. 从不订购的客户

183. 从不订购的客户 Customers 表&#xff1a; -------------------- | Column Name | Type | -------------------- | id | int | | name | varchar | -------------------- 在 SQL 中&#xff0c;id 是该表的主键。 该表的每一行都表示客户的 ID 和名称。 Orders 表&#…

HTML5滑块(Slider)

HTML5 的滑块&#xff08;Slider&#xff09;控件允许用户通过拖动滑块来选择数值。以下是如何实现一个简单的滑块组件的详细说明。 HTML5 滑块组件 1. 基本结构 使用 <input type"range"> 元素可以创建一个滑块。下面是基本实现的代码示例&#xff1a; <…

报错:websocket注入为null,已解决!

错误截图 原因分析&#xff1a; WebSocket 在 Spring 框架中的注入问题是由其生命周期与 Spring 容器的作用域不一致引起的。spring管理的都是单例&#xff08;singleton&#xff09;&#xff0c;和 websocket &#xff08;多对象&#xff09;相冲突。如果你的WebSocket 处理类…

ClickHouse副本搭建

一. 副本概述 副本的目的主要是保障数据的高可用性&#xff0c;ClickHouse中的副本没有主从之分。所有的副本都是平等的。 副本写入流程&#xff1a; 二. 副本搭建 1. 实验环境 hadoop1(192.168.47.128) hadoop2(192.168.47.129)2. 修改配置文件 修改两台主机/etc/click…

ChatBI来啦!NBAI 正式上线 NL2SQL 功能

NebulaAI 现已正式上线 NL2SQL 功能&#xff0c;免费开放使用&#xff01; 什么是 NL2SQL&#xff1f;NL2SQL 即通过自然语言交互&#xff0c;用户可以轻松查询、分析和管理数据库中的数据&#xff08;ChatBI&#xff09;&#xff0c;从此摆脱传统复杂的数据库操作。 欢迎免费…

科技云报到:洞见2025年科技潮流,技术大融合开启“智算时代”

科技云报到原创。 随着2024年逐渐接近尾声&#xff0c;人们不禁开始展望即将到来的2025年。这一年&#xff0c;被众多科技界人士视为开启新纪元的关键节点。站在新的起点上&#xff0c;我们将亲眼目睹未来科技如何改变我们的世界。从人工智能到量子计算&#xff0c;从基因编辑…

【数据仓库】spark大数据处理框架

文章目录 概述架构spark 架构角色下载安装启动pyspark启动spark-sehll启动spark-sqlspark-submit经验 概述 Spark是一个性能优异的集群计算框架&#xff0c;广泛应用于大数据领域。类似Hadoop&#xff0c;但对Hadoop做了优化&#xff0c;计算任务的中间结果可以存储在内存中&a…

标准库以及HAL库——按键控制LED灯代码

按键控制LED本质还是控制GPIO,和点亮一个LED灯没什么区别 点亮一个LED灯&#xff1a;是直接控制输出引脚&#xff0c;GPIO初始化推挽输出即可 按键控制LED&#xff1a;是按键输入信号从而控制输出引脚&#xff0c;GPIO初始化推挽输出一个引脚以外还得加一个GPIO上拉输入 但是…