shardingsphere-proxy 搭建mysql的分库分表

news2024/11/14 15:42:15

1、docker安装mysql5.7版本

  1. 拉取mysql的镜像
docker pull mysql:5.7
  1. 创建mysql的配置目录,日志目录,数据存储的目录
mkdir -p /home/sunyuhua/docker/mysql/conf
mkdir -p /home/sunyuhua/docker/mysql/logs
mkdir -p /home/sunyuhua/docker/mysql/data
  1. 启动mysql的容器
docker run -p 3306:3306 --name mysql  --restart=always -v /home/sunyuhua/docker/mysql/conf:/etc/mysql/conf.d -v /home/sunyuhua/docker/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=root -d mysql:5.7 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
  1. 修改 mysql的配置
/home/sunyuhua/docker/mysql/conf/my.cnf

[client]
port =3306
socket =/var/run/mysqld/mysqld.sock
[mysql]
socket =/var/run/mysqld/mysqld.sock
[mysql_safe]
socket =/var/run/mysqld/mysqld.sock
nice =0


[mysqld]
server-id = 1
datadir = /var/lib/mysql
socket = /var/run/mysqld/mysqld.sock
port = 3306
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
log-bin=mysql-bin
binlog-format=row
binlog-row-image=full
max_connections=600
  1. 重新mysql
docker restart mysql
  1. 链接mysql,测试
docker exec -it mysql /bin/bash
mysql -uroot -proot

2、docker 安装zookeeper

  1. 拉取zookeeper镜像
docker pull zookeeper
  1. 运行zookeeper
docker run -d -e TZ="Asia/Shanghai"  -p 2181:2181 -v /home/sunyuhua/docker/zookeeper:/data --name zookeeper --restart always zookeeper
  1. 检查zookeeper安装成功
docker exec -it zookeeper bash

./bin/zkCli.sh

3、docker安装shardingsphere-proxy

  1. 获取镜像中的配置到挂载目录下
docker run -d --name tmp --entrypoint=bash apache/shardingsphere-proxy

docker cp tmp:/opt/shardingsphere-proxy/conf /home/sunyuhua/docker/shardingsphere-proxy/conf

docker rm tmp
  1. 启动shardingsphere-proxy
docker run -d -v /home/sunyuhua/docker/shardingsphere-proxy/conf:/opt/shardingsphere-proxy/conf -v /home/sunyuhua/docker/shardingsphere-proxy/ext-lib:/opt/shardingsphere-proxy/ext-lib -v /home/sunyuhua/docker/shardingsphere-proxy/logs:/opt/shardingsphere-proxy/logs -e PORT=3308 -p3308:3308  --restart always  --name sharding-proxy apache/shardingsphere-proxy
  1. 验证是否安装成功
 docker exec -it sharding-proxy /bin/bash

4、配置分库分表的准备mysql的表结构

create database demo_ds_0;

show databases;

use demo_ds_0;


CREATE TABLE `t_order_0` (
  `order_id` bigint(20) unsigned NOT NULL COMMENT '主键ID',
  `user_id` bigint(20) unsigned NOT NULL COMMENT '用户ID',
  `total_money` int(10) unsigned NOT NULL COMMENT '订单总金额',
  PRIMARY KEY (`order_id`),
  KEY `idx_user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单总表';


CREATE TABLE `t_order_1` (
  `order_id` bigint(20) unsigned NOT NULL COMMENT '主键ID',
  `user_id` bigint(20) unsigned NOT NULL COMMENT '用户ID',
  `total_money` int(10) unsigned NOT NULL COMMENT '订单总金额',
  PRIMARY KEY (`order_id`),
  KEY `idx_user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单总表';




CREATE TABLE `t_order_item_0` (
  `order_item_id` bigint(20) unsigned NOT NULL COMMENT '子订单ID',
  `order_id` bigint(20) unsigned NOT NULL COMMENT '主键ID',
  `user_id` bigint(20) unsigned NOT NULL COMMENT '用户ID',
  `money` int(10) unsigned NOT NULL COMMENT '子订单金额',
  PRIMARY KEY (`order_item_id`),
  KEY `idx_order_id` (`order_id`) USING BTREE,
  KEY `idx_user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单子表';




CREATE TABLE `t_order_item_1` (
  `order_item_id` bigint(20) unsigned NOT NULL COMMENT '子订单ID',
  `order_id` bigint(20) unsigned NOT NULL COMMENT '主键ID',
  `user_id` bigint(20) unsigned NOT NULL COMMENT '用户ID',
  `money` int(10) unsigned NOT NULL COMMENT '子订单金额',
  PRIMARY KEY (`order_item_id`),
  KEY `idx_order_id` (`order_id`) USING BTREE,
  KEY `idx_user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单子表';


create database demo_ds_1;

show databases;

use demo_ds_1;


CREATE TABLE `t_order_0` (
  `order_id` bigint(20) unsigned NOT NULL COMMENT '主键ID',
  `user_id` bigint(20) unsigned NOT NULL COMMENT '用户ID',
  `total_money` int(10) unsigned NOT NULL COMMENT '订单总金额',
  PRIMARY KEY (`order_id`),
  KEY `idx_user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单总表';


CREATE TABLE `t_order_1` (
  `order_id` bigint(20) unsigned NOT NULL COMMENT '主键ID',
  `user_id` bigint(20) unsigned NOT NULL COMMENT '用户ID',
  `total_money` int(10) unsigned NOT NULL COMMENT '订单总金额',
  PRIMARY KEY (`order_id`),
  KEY `idx_user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单总表';




CREATE TABLE `t_order_item_0` (
  `order_item_id` bigint(20) unsigned NOT NULL COMMENT '子订单ID',
  `order_id` bigint(20) unsigned NOT NULL COMMENT '主键ID',
  `user_id` bigint(20) unsigned NOT NULL COMMENT '用户ID',
  `money` int(10) unsigned NOT NULL COMMENT '子订单金额',
  PRIMARY KEY (`order_item_id`),
  KEY `idx_order_id` (`order_id`) USING BTREE,
  KEY `idx_user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单子表';




CREATE TABLE `t_order_item_1` (
  `order_item_id` bigint(20) unsigned NOT NULL COMMENT '子订单ID',
  `order_id` bigint(20) unsigned NOT NULL COMMENT '主键ID',
  `user_id` bigint(20) unsigned NOT NULL COMMENT '用户ID',
  `money` int(10) unsigned NOT NULL COMMENT '子订单金额',
  PRIMARY KEY (`order_item_id`),
  KEY `idx_order_id` (`order_id`) USING BTREE,
  KEY `idx_user_id` (`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单子表';


5、配置shardingsphere-proxy分库分表的策略

修改server.xml文件,文件地址:/home/sunyuhua/docker/shardingsphere-proxy/conf

mode:
  type: Cluster
  repository:
    type: ZooKeeper
    props:
      namespace: governance_ds
      server-lists: 127.0.0.1:2181
      retryIntervalMilliseconds: 500
      timeToLiveSeconds: 60
      maxRetries: 3
      operationTimeoutMilliseconds: 500
#  overwrite: false
#
rules:
  - !AUTHORITY
    users:
      - root@%:root
      - sharding@:sharding
    provider:
      type: ALL_PRIVILEGES_PERMITTED
#  - !TRANSACTION
#    defaultType: XA
#    providerType: Atomikos

props:
#  max-connections-size-per-query: 1
#  kernel-executor-size: 16  # Infinite by default.
#  proxy-frontend-flush-threshold: 128  # The default value is 128.
#  proxy-opentracing-enabled: false
#  proxy-hint-enabled: false
  sql-show: true
#  check-table-metadata-enabled: false
#  show-process-list-enabled: false
#    # Proxy backend query fetch size. A larger value may increase the memory usage of ShardingSphere Proxy.
#    # The default value is -1, which means set the minimum value for different JDBC drivers.
#  proxy-backend-query-fetch-size: -1
#  check-duplicate-table-enabled: false
#  sql-comment-parse-enabled: false
#  proxy-frontend-executor-size: 0 # Proxy frontend executor size. The default value is 0, which means let Netty decide.
#    # Available options of proxy backend executor suitable: OLAP(default), OLTP. The OLTP option may reduce time cost of writing packets to client, but it may increase the latency of SQL execution
#    # if client connections are more than proxy-frontend-netty-executor-size, especially executing slow SQL.
#  proxy-backend-executor-suitable: OLAP
#  proxy-frontend-max-connections: 0 # Less than or equal to 0 means no limitation.
#  sql-federation-enabled: false

修改config-sharding.yaml 文件,文件地址/home/sunyuhua/docker/shardingsphere-proxy/conf


schemaName: sharding_db

dataSources:
  ds_0:
    url: jdbc:mysql://127.0.0.1:3306/demo_ds_0?serverTimezone=UTC&useSSL=false
    username: root
    password: root
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1
  ds_1:
    url: jdbc:mysql://127.0.0.1:3306/demo_ds_1?serverTimezone=UTC&useSSL=false
    username: root
    password: root
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1

rules:
- !SHARDING
  tables:
    t_order:
      actualDataNodes: ds_${0..1}.t_order_${0..1}
      tableStrategy:
        standard:
          shardingColumn: order_id
          shardingAlgorithmName: t_order_inline
      keyGenerateStrategy:
        column: order_id
        keyGeneratorName: snowflake
    t_order_item:
      actualDataNodes: ds_${0..1}.t_order_item_${0..1}
      tableStrategy:
        standard:
          shardingColumn: order_id
          shardingAlgorithmName: t_order_item_inline
      keyGenerateStrategy:
        column: order_item_id
        keyGeneratorName: snowflake
  bindingTables:
    - t_order,t_order_item
  defaultDatabaseStrategy:
    standard:
      shardingColumn: user_id
      shardingAlgorithmName: database_inline
  defaultTableStrategy:
    none:
  
  shardingAlgorithms:
    database_inline:
      type: INLINE
      props:
        algorithm-expression: ds_${user_id % 2}
    t_order_inline:
      type: INLINE
      props:
        algorithm-expression: t_order_${order_id % 2}
    t_order_item_inline:
      type: INLINE
      props:
        algorithm-expression: t_order_item_${order_id % 2}
  
  keyGenerators:
    snowflake:
      type: SNOWFLAKE
      props:
        worker-id: 123

重新启动shardingsphere

docker restart sharding-proxy

检查shardingsphere-proxy是不是启动

docker logs sharding-proxy

或者查看日志

 /opt/shardingsphere-proxy/logs/stdout.log

[INFO ] 2023-06-28 05:46:54.015 [main-SendThread(host.docker.internal:2181)] org.apache.zookeeper.ClientCnxn - Session establishment complete on server host.docker.internal/192.168.65.2:2181, session id = 0x100000045ca0001, negotiated timeout = 40000
[INFO ] 2023-06-28 05:46:54.024 [main-EventThread] o.a.c.f.state.ConnectionStateManager - State change: CONNECTED
[INFO ] 2023-06-28 05:46:54.052 [main-EventThread] o.a.c.framework.imps.EnsembleTracker - New config event received: {}
[INFO ] 2023-06-28 05:46:54.052 [main-EventThread] o.a.c.framework.imps.EnsembleTracker - New config event received: {}
Thanks for using Atomikos! Evaluate http://www.atomikos.com/Main/ExtremeTransactions for advanced features and professional support
or register at http://www.atomikos.com/Main/RegisterYourDownload to disable this message and receive FREE tips & advice
[INFO ] 2023-06-28 05:46:56.075 [main] o.apache.curator.utils.Compatibility - Using org.apache.zookeeper.server.quorum.MultipleAddresses
[INFO ] 2023-06-28 05:46:56.093 [main] o.a.s.p.i.BootstrapInitializer - Database name is `MySQL`, version is `5.7.42-log`
[INFO ] 2023-06-28 05:46:56.283 [main] o.a.s.p.frontend.ShardingSphereProxy - ShardingSphere-Proxy start success

6、插入和查询数据,检查分库分表策略是不是生效

在这里插入图片描述

7、检查物理库是不是已经插入成功

在这里插入图片描述

错误汇总:

1、如果出现zookeeper 2181端口链接不上,是因为docker容器之间的网络通信问题

需要修改server.xml 中 zookeeper的链接地址

[WARN ] 2023-06-28 01:53:18.091 [main-SendThread(127.0.0.1:2181)] org.apache.zookeeper.ClientCnxn - Session 0x0 for sever localhost/127.0.0.1:2181, Closing socket connection. Attempting reconnect except it is a SessionExpiredException.
java.net.ConnectException: Connection refused
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:716)
        at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:342)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1262)
[INFO ] 2023-06-28 01:53:19.194 [main-SendThread(127.0.0.1:2181)] org.apache.zookeeper.ClientCnxn - Opening socket connection to server localhost/127.0.0.1:2181.
[INFO ] 2023-06-28 01:53:19.194 [main-SendThread(127.0.0.1:2181)] org.apache.zookeeper.ClientCnxn - SASL config status: Will not attempt to authenticate using SASL (unknown error)
[WARN ] 2023-06-28 01:53:19.195 [main-SendThread(127.0.0.1:2181)] org.apache.zookeeper.ClientCnxn - Session 0x0 for sever localhost/127.0.0.1:2181, Closing socket connection. Attempting reconnect except it is a SessionExpiredException.
java.net.ConnectException: Connection refused
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:716)
        at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:342)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1262)
[INFO ] 2023-06-28 01:53:19.592 [Curator-Framework-0] o.a.c.f.imps.CuratorFrameworkImpl - backgroundOperationsLoop exiting
[INFO ] 2023-06-28 01:53:20.296 [main-SendThread(127.0.0.1:2181)] org.apache.zookeeper.ClientCnxn - Opening socket connection to server localhost/127.0.0.1:2181.
[INFO ] 2023-06-28 01:53:20.296 [main-SendThread(127.0.0.1:2181)] org.apache.zookeeper.ClientCnxn - SASL config status: Will not attempt to authenticate using SASL (unknown error)
[WARN ] 2023-06-28 01:53:20.297 [main-SendThread(127.0.0.1:2181)] org.apache.zookeeper.ClientCnxn - An exception was thrown while closing send thread for session 0x0.
java.net.ConnectException: Connection refused
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:716)
        at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:342)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1262)
[INFO ] 2023-06-28 01:53:20.400 [main] org.apache.zookeeper.ZooKeeper - Session: 0x0 closed
[INFO ] 2023-06-28 01:53:20.400 [main-EventThread] org.apache.zookeeper.ClientCnxn - EventThread shut down for session: 0x0
Exception in thread "main" org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryException: org.apache.zookeeper.KeeperException$OperationTimeoutException: KeeperErrorCode = OperationTimeout
        at org.apache.shardingsphere.mode.repository.cluster.zookeeper.handler.CuratorZookeeperExceptionHandler.handleException(CuratorZookeeperExceptionHandler.java:51)
        at org.apache.shardingsphere.mode.repository.cluster.zookeeper.CuratorZookeeperRepository.initCuratorClient(CuratorZookeeperRepository.java:128)
        at org.apache.shardingsphere.mode.repository.cluster.zookeeper.CuratorZookeeperRepository.init(CuratorZookeeperRepository.java:82)
        at org.apache.shardingsphere.mode.manager.cluster.ClusterContextManagerBuilder.createClusterPersistRepository(ClusterContextManagerBuilder.java:119)
        at org.apache.shardingsphere.mode.manager.cluster.ClusterContextManagerBuilder.beforeBuildContextManager(ClusterContextManagerBuilder.java:94)
        at org.apache.shardingsphere.mode.manager.cluster.ClusterContextManagerBuilder.build(ClusterContextManagerBuilder.java:84)
        at org.apache.shardingsphere.proxy.initializer.BootstrapInitializer.initContext(BootstrapInitializer.java:77)
        at org.apache.shardingsphere.proxy.initializer.BootstrapInitializer.init(BootstrapInitializer.java:68)
        at org.apache.shardingsphere.proxy.Bootstrap.main(Bootstrap.java:47)
Caused by: org.apache.zookeeper.KeeperException$OperationTimeoutException: KeeperErrorCode = OperationTimeout
        at org.apache.shardingsphere.mode.repository.cluster.zookeeper.CuratorZookeeperRepository.initCuratorClient(CuratorZookeeperRepository.java:125)
        ... 7 more
[ERROR] 2023-06-28 05:38:44.350 [main] com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Exception during pool initialization.
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
        at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:990)
        at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:342)
        at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2197)
        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2230)
        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2025)
        at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:778)
        at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:386)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330)
        at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
        at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:354)
        at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:202)
        at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:473)
        at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:554)
        at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
        at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81)
        at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.decorator.HikariJDBCParameterDecorator.decorate(HikariJDBCParameterDecorator.java:49)
        at org.apache.shardingsphere.proxy.backend.communication.jdbc.datasource.decorator.HikariJDBCParameterDecorator.decorate(HikariJDBCParameterDecorator.java:30)
        at org.apache.shardingsphere.infra.config.datasource.JDBCParameterDecoratorHelper.decorate(JDBCParameterDecoratorHelper.java:41)
        at org.apache.shardingsphere.infra.config.datasource.DataSourceConverter.getDataSource(DataSourceConverter.java:48)
        at org.apache.shardingsphere.infra.config.datasource.DataSourceConverter.lambda$getDataSourceMap$0(DataSourceConverter.java:68)
        at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1321)
        at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
        at java.util.Iterator.forEachRemaining(Iterator.java:116)
        at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
        at org.apache.shardingsphere.infra.config.datasource.DataSourceConverter.getDataSourceMap(DataSourceConverter.java:68)
        at org.apache.shardingsphere.proxy.initializer.BootstrapInitializer.getDataSourcesMap(BootstrapInitializer.java:86)
        at org.apache.shardingsphere.proxy.initializer.BootstrapInitializer.initContext(BootstrapInitializer.java:76)
        at org.apache.shardingsphere.proxy.initializer.BootstrapInitializer.init(BootstrapInitializer.java:68)
        at org.apache.shardingsphere.proxy.Bootstrap.main(Bootstrap.java:47)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:607)
        at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:211)
        at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:301)
        ... 38 common frames omitted

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

服务器日志处理,文件截取关键字

临近年中述职&#xff0c;需要各种量化参数&#xff0c;服务稳定性是上半年的重中之重&#xff0c;所以需要重点列出说服性指标&#xff0c;因此各种错误吗的统计信息便是重要信息&#xff0c;因为公司的日志采集系统因上云缘故&#xff0c;导致历史数据丢失没法查询&#xff0…

Jetpack Compose实现 验证码输入框

highlight: androidstudio Jetpack Compose 作为 Android 的新一代 UI 开发框架,提供了非常强大的工具来构建用户界面。 今天,我们就利用 Compose 来实现一个炫酷的验证码输入框! 开始的思路是用6个TextField来实现 // 用于存储验证码的长度 val codeLength 6 // 定义一个…

Cesium 实战 - 使用 gltf-vscode 查看、预览以及编辑 glTF 和 GLB 模型

Cesium 实战 - 使用 gltf-vscode 查看、预览以及编辑 glTF 和 GLB 模型 VScode&#xff08;Visual Studio Code&#xff09; 安装模型必要插件VScode 预览自定义关节&#xff08;articulations&#xff09;动作VScode 导入 GLB 格式模型VScode 导出 GLB 格式模型 模型渲染作为 …

【什么是iMessage苹果推】怎样来获取设备令牌(Device Token)实现步骤

要获取设备令牌&#xff08;Device Token&#xff09;&#xff0c;您需要在应用程序中实现以下步骤&#xff1a; 在应用程序中请求用户授权&#xff1a;您需要请求用户授权允许应用程序发送远程通知。这可以通过使用 UNUserNotificationCenter&#xff08;User Notifications …

Linux学习之以openresty为例学习源码安装软件

https://github.com/openresty/openresty/tags里边有openresty各个版本的源码。 https://openresty.org/en/是官网。 wget https://github.com/openresty/openresty/archive/refs/tags/v1.15.8.1.tar.gz(github网址)或者wget https://openresty.org/download/openresty-1.15.…

6月29日第壹简报,星期四,农历五月十二

6月29日第壹简报&#xff0c;星期四&#xff0c;农历五月十二&#xff0c;早安&#xff01;坚持阅读&#xff0c;静待花开1. 中国移动元宇宙产业联盟成立&#xff0c;科大讯飞、华为、小米等为首批成员。2. 离岸人民币兑美元跌破7.25关口&#xff0c;创去年11月末来低位。3. 成…

STC89C52与LCD1602液晶显示的软硬件仿真

STC89C52与LCD1602液晶显示的软硬件仿真 硬件仿真平台&#xff1a;protues8.13 软件仿真平台&#xff1a;keil5 硬件连接图&#xff1a; 软件代码实现&#xff1a; &#xff08;复制后 粘贴到keil5中&#xff0c;即可使用&#xff0c;无需修改&#xff09; #include <RE…

SpringCloud-Nacos注册中心

文章目录 Nacos注册中心服务注册到nacos1&#xff09;引入依赖2&#xff09;配置nacos地址3&#xff09;重启 5.3.服务分级存储模型给user-service配置集群同集群优先的负载均衡 权重配置环境隔离创建namespace给微服务配置namespace Nacos与Eureka的区别 Nacos注册中心 服务注…

v8-tc39-ecma262: at,代替“arr[0]“取值

首先是语义化 其次是函数式&#xff0c;意味着加入流式调用队列 如上图&#xff0c;解释如下&#xff1a; 对象&#xff0c;调用对象函数处理类数组&#xff0c;调用类数组处理关联下标&#xff1f;转为Integer或者Infinity类型如果下标的值大于等于0&#xff0c;则设置赋值给…

Windows 驱动开发环境搭建

Windows 驱动开发环境搭建及 windbg 调试工具安装使用 引言了解 Windows 驱动开发环境下载 Windows 驱动开发环境根据需要下载安装对应版本的 Visual Studio下载安装对应的 WDK 工具包 编写第一个驱动代码总结参考资料 引言 对于 Windows 驱动开发&#xff0c;在微软官方的文档…

go定时任务crontab

在linux里可以通过crontab -e或者vi /etc/crontab编辑定时任务&#xff0c;区别在于后者只有root用户可以&#xff0c;还可以指定shell环境&#xff0c;不建议修改&#xff0c;修改前建议备份&#xff0c;前者任何用户都可以使用&#xff0c;两者修改后都不用修改自动重启。 1…

尚无忧宠物托运小程序app源码前景如何?

宠物托运市场调研分析 由于宠物托运在交通运输中并不是一个很大的类目&#xff0c;行业尚缺乏标准的流程规范与相关的监管机制&#xff0c;目前我国市面上常见的三方宠物托运公司多无正规手续&#xff0c;更有多数公司不具备相关运输资质。 如今&#xff0c;宠物经济不断崛起…

Linux:安装tomcat

注意&#xff1a;1.安装tomcat时最好用非root用户安装 2.可以选择新建一个用户&#xff0c;用户安装部署tomcat&#xff0c;本文将继续用fovace账户进行tomcat安装 一、前置条件 安装tomcat需要先安装jdk&#xff0c;所以先确定系统中是否已经有jdk&#xff0c;如下&#xff1a…

Minecraft-生成运行Spigot服务端

一、安装 先下载一个.jar的服务端核心&#xff0c;选择自己需要的版本 spigot核心下载 二、配置 下载完后&#xff0c;创建一个.bat批处理文件 内容填写如下&#xff0c;xxx.jar是你下载的核心名称 -Xms1G表示服务器所使用的最低运行内存为1G -Xmx1G表示服务器所使用的最高运行…

力扣 113. 路径总和 II

题目来源&#xff1a;https://leetcode.cn/problems/path-sum-ii/description/ C题解&#xff1a;采用递归法&#xff0c;前序遍历&#xff0c;遍历每个叶子节点&#xff0c;路径和满足条件则将该路径保存下来。 class Solution { public:void getlujing(TreeNode* node, int …

【MySQL】表中插入数据时,查询时,中文数据变成??

解决办法&#xff1a; 重新创建一个表&#xff08;users&#xff09; 将字符集那栏勾选上

[Windows] 电脑专属后花园 HideUL软件隐藏工具v1.0便携版

如下图所示:这一堆乱七八糟的东西,看起来又特难受…… 下载:https://download.csdn.net/download/mo3408/87961003 更有甚者,如果我们在电脑安装了一些比较特殊且不方便被别人看到的软件,也是一件麻烦事。 所以,今天我就给大家推荐一款可以隐藏电脑软件的小工具,仅需简…

【致敬未来的攻城狮计划】打卡4:检测按键

按键模块 后台轮询 按键也是一个比较简单的模块&#xff0c;主要是为了学习IO输入模式。 查看RA2E1电路图可见&#xff1a; 按键相关引脚是004引脚&#xff0c;默认上拉高电平&#xff0c;按下接地为低电平。 首先第一步还是设置对应引脚。类似上一期设置LED的方式&#xf…

【电磁泄密】网络杂谈(2)之电磁泄密及防护

涉及知识点 什么是电磁泄密&#xff0c;电磁泄密的渠道&#xff0c;电磁泄密该如何去防护&#xff0c;电磁泄密的防护标准。深入了解电磁泄密防护手段。 原创于&#xff1a;CSDN博主-《拄杖盲学轻声码》&#xff0c;更多内容可去其主页关注下哈&#xff0c;不胜感激 文章目录 …

内存分区.

内存模型分区&#xff1a; ****代码区&#xff1a;存放CPU执行的机器指令。通常代码区是可共享的(即另外的执行程序可以调用它)&#xff0c;使其可共享的目的是对于频繁被执行的程序&#xff0c;只需要在内存中有一份代码即可。代码区通常楚只读的&#xff0c;使其只读的原因是…