企业实战_16_MyCat全局自增ID

接上一篇:企业实战_15_MySql主从复制到MyCat总结
https://gblfy.blog.csdn.net/article/details/118657995

文章目录

          • 一、准备工作
            • 1. Mycat全局自增实现思路
            • 2. 创建mycat数据库
            • 3. 导入初始化脚本
            • 4. 登录验证
          • 二、配置文件修改
            • 2.1. server.xml配置
            • 2.2. 添加数据节点
            • 2.3. 验证im_mycat权限
            • 2.4. 配置数据节点和逻辑表明
            • 2.5. 设置自增属性
            • 2.6. 开启自增属性
            • 2.7. 赋予权限
          • 三、测试验证
            • 3.1. 重启mycat
            • 3.2. 数据清理
            • 3.3. 批量插入数据
            • 3.4. 查看数据
            • 3.5. 得出结论
            • 3.6. 执行记录

一、准备工作
1. Mycat全局自增实现思路
  • 在任意节点创建mycat数据库
  • 将/app/mycat/conf/dbseq.sql文件中的数据导入到mycat数据库中
  • 修改schema.xml文件添加主机节点和数据节点,如果主机节点已经存在,可以不添加
  • 修改server.xml设置增增ID生成类型为数据库形式
  • 修改 sequence_db_conf.properties文件,设置那些逻辑表需要自增ID和数据节点的名称
  • 给mycat数据库中的MYCAT_SEQUENCE 表插入一条数据,设置定增属性
  • 修改schema.xml文件,设置给哪个逻辑表自用自增ID
  • 赋予mycat用户操作函数的权限
  • 重新启动mycat
  • 数据清理
  • 批量插入数据,查看order_id 是否重复
2. 创建mycat数据库

在任意节点,创建mycat数据库,这里演示在node1节点创建mycat数据库

# 登录node1节点的mysql
mysql -uroot -p123456# 查看数据库列表
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| imooc_db           |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.01 sec)# 创建数据库
create database mycat;mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| imooc_db           |
| mycat              |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
6 rows in set (0.00 sec)

注:其他节点创建mycat数据库一样

3. 导入初始化脚本

将dbseq.sql导入MyCat数据库中

# 进入mycat的conf目录
cd /app/mycat/conf# 初始化表结构脚本
mysql -uroot -p mycat < dbseq.sql
4. 登录验证
# 登录mycat数据库
mysql -uroot -p123456# 使用mycat数据库
use mycat;# 查看初始化脚本后的数据库有哪些对象
show tables;# 查看MYCAT_SEQUENCE表中数据
select * from MYCAT_SEQUENCE;可以看出设置了全局id 1 自增1
mysql> use mycat;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql> show tables;
+-----------------+
| Tables_in_mycat |
+-----------------+
| MYCAT_SEQUENCE  |
+-----------------+
1 row in set (0.00 sec)mysql> select * from MYCAT_SEQUENCE;
+--------+---------------+-----------+
| name   | current_value | increment |
+--------+---------------+-----------+
| GLOBAL |             1 |         1 |
+--------+---------------+-----------+
1 row in set (0.00 sec)
二、配置文件修改
2.1. server.xml配置
cd /app/mycat/conf/
vim server.xml
<!--
0-以本地文件生成序列号
1-以数据库形式
2-时间戳序列
3-以zookeeper形式生成自增序列
-->
# 将此属性修改为1 ,1代表从数据库中读取
# 告诉mycat我是石勇数据库读取的方式生成全局自增id
<property name="sequnceHandlerType">1</property>
2.2. 添加数据节点

在schema.xml文件中,添加数据主机节点

<dataHost name="mysql92101" maxCon="1000" minCon="10" balance="3" writeType="0" dbType="mysql" dbDriver="native" switchType="1"><heartbeat>select user()</heartbeat><writeHost host="192.168.92.101" url="192.168.92.101:3306" user="im_mycat" password="123456"></writeHost></dataHost>

添加数据节点

<dataNode name="mycat"    dataHost="mysql92101" database="mycat" />

注:如果mycat数据库和分片的某一个数据库节点在一个mysql中,添加dohost节点这一步可以省略

2.3. 验证im_mycat权限
# 登录mysql
mysql -uroot -p123456# 使用mysql数据库
mysql> use mysql;
Database changed
mysql> select user,host from user;
+---------------+--------------+
| user          | host         |
+---------------+--------------+
| root          | %            |
| im_mycat      | 192.168.92.% |
| im_repl       | 192.168.92.% |
| mysql.session | localhost    |
| mysql.sys     | localhost    |
+---------------+--------------+
5 rows in set (0.00 sec)# 查看im_mycat用户权限
mysql> show grants for im_mycat@'192.168.92.%';
+-----------------------------------------------------------------------------------+
| Grants for im_mycat@192.168.92.%                                                  |
+-----------------------------------------------------------------------------------+
| GRANT SELECT, INSERT, UPDATE, DELETE, EXECUTE ON *.* TO 'im_mycat'@'192.168.92.%' |
+-----------------------------------------------------------------------------------+
1 row in set (0.00 sec)
2.4. 配置数据节点和逻辑表明

sequence_db_conf.properties

  • 数据节点
  • 自增表和mycay数据库所在数据节点名称
# 指定表、函数所在的数据节点
vim sequence_db_conf.propertiesGLOBAL=mycat
# ORDER_MASTER表所在的数据节点
ORDER_MASTER=mycat
2.5. 设置自增属性

最后在mycat数据库中,给mycat_sequence 插入一条数据,设置自增属性
insert into mycat_sequence values (‘order_key’,1,1);
#再次查看

# 登录mysql
mysql -uroot -p123456# 使用mycat数据库
use mycat;# 查询MYCAT_SEQUENCE
select *  from MYCAT_SEQUENCE;# 给MYCAT_SEQUENCE 插入一条数据,设置定增属性
insert into MYCAT_SEQUENCE VALUES ('ORDER_MASTER',1,1);# 再次查看
select *  from MYCAT_SEQUENCE;

执行记录:

mysql> use mycat
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql> select *  from MYCAT_SEQUENCE;
+--------+---------------+-----------+
| name   | current_value | increment |
+--------+---------------+-----------+
| GLOBAL |             1 |         1 |
+--------+---------------+-----------+
1 row in set (0.00 sec)mysql> insert into MYCAT_SEQUENCE VALUES ('ORDER_MASTER',1,1);
Query OK, 1 row affected (0.01 sec)mysql> select *  from MYCAT_SEQUENCE;
+--------------+---------------+-----------+
| name         | current_value | increment |
+--------------+---------------+-----------+
| GLOBAL       |             1 |         1 |
| ORDER_MASTER |             1 |         1 |
+--------------+---------------+-----------+
2 rows in set (0.00 sec)mysql> 
2.6. 开启自增属性

在ORDER_MASTER 的逻辑表中添加autoIncrement="true"属性
在逻辑表(ORDER_MASTER )中,添加autoIncrement="true"属性

cd /app/mycat/confvim schema.xml
<table name="order_master"          primaryKey="order_id"          dataNode="ordb01,ordb02,ordb03,ordb04" rule="order_master" autoIncrement="true"/>
2.7. 赋予权限

赋予权限im_mycat用户执行函数的权限

mysql -uroot -p123456
use mysql;
show grants for im_mycat@'192.168.92.%';#  赋予权限`im_mycat`用户执行函数的权限
grant execute on *.* to 'im_mycat'@'192.168.92.%';show grants for im_mycat@'192.168.92.%';

执行日志

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql> show grants for im_mycat@'192.168.92.%';
+-----------------------------------------------------------------------------------+
| Grants for im_mycat@192.168.92.%                                                  |
+-----------------------------------------------------------------------------------+
| GRANT SELECT, INSERT, UPDATE, DELETE, EXECUTE ON *.* TO 'im_mycat'@'192.168.92.%' |
+-----------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> grant execute on *.* to 'im_mycat'@'192.168.92.%';
Query OK, 0 rows affected (0.01 sec)mysql> show grants for im_mycat@'192.168.92.%';
+-----------------------------------------------------------------------------------+
| Grants for im_mycat@192.168.92.%                                                  |
+-----------------------------------------------------------------------------------+
| GRANT SELECT, INSERT, UPDATE, DELETE, EXECUTE ON *.* TO 'im_mycat'@'192.168.92.%' |
+-----------------------------------------------------------------------------------+
1 row in set (0.00 sec)mysql> 
三、测试验证
3.1. 重启mycat

重新启动mycat

mycat stopmycat start
3.2. 数据清理
mysql  -uapp_imooc -p123456 -h192.168.92.101 -P8066 
use imooc_db;
delete from order_master;
3.3. 批量插入数据
INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_money,shipping_money,payment_money,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time)  VALUES (1, 1, '雨昕', 1, 1, 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, '2021-07-11 20:20:25');
INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_money,shipping_money,payment_money,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time)  VALUES (2, 2, '雨昕', 1, 1, 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, '2021-07-11 20:20:25');
INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_money,shipping_money,payment_money,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time)  VALUES (1, 3, '雨昕', 1, 1, 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, '2021-07-11 20:20:25');
INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_money,shipping_money,payment_money,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time)  VALUES (1, 4, '雨昕', 1, 1, 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, '2021-07-11 20:20:25');
INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_money,shipping_money,payment_money,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time)  VALUES (1, 5, '雨昕', 1, 1, 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, '2021-07-11 20:20:25');
INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_money,shipping_money,payment_money,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time)  VALUES (1, 6, '雨昕', 1, 1, 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, '2021-07-11 20:20:25');
INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_money,shipping_money,payment_money,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time)  VALUES (1, 7, '雨昕', 1, 1, 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, '2021-07-11 20:20:25');
INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_money,shipping_money,payment_money,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time)  VALUES (1, 8, '雨昕', 1, 1, 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, '2021-07-11 20:20:25');
INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_money,shipping_money,payment_money,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time)  VALUES (1, 9, '雨昕', 1, 1, 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, '2021-07-11 20:20:25');
INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_money,shipping_money,payment_money,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time)  VALUES ( 1,10, '雨昕', 1, 1, 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, '2021-07-11 20:20:25');
3.4. 查看数据
mysql> select customer_id,order_sn,order_id  from order_master order by order_id;
+-------------+----------+----------+
| customer_id | order_sn | order_id |
+-------------+----------+----------+
|           1 |        1 |        2 |
|           2 |        2 |        3 |
|           3 |        1 |        4 |
|           4 |        1 |        5 |
|           5 |        1 |        6 |
|           6 |        1 |        7 |
|           7 |        1 |        8 |
|           8 |        1 |        9 |
|           9 |        1 |       10 |
|          10 |        1 |       11 |
+-------------+----------+----------+
10 rows in set (0.03 sec)
3.5. 得出结论

经过配置之后,订单order_id就不会重复了

下一篇:企业实战_12_Mycat水平扩展_跨分片查询_ER分片

https://blog.csdn.net/weixin_40816738/article/details/100066013

3.6. 执行记录
[root@node1 ~]# mysql  -uapp_imooc -p123456 -h192.168.92.101 -P8066 
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.29-mycat-1.6.5-release-20180122220033 MyCat Server (OpenCloundDB)Copyright (c) 2000, 2021, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;
+----------+
| DATABASE |
+----------+
| imooc_db |
+----------+
1 row in set (0.00 sec)mysql> use imooc_db;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql> show tables;
+-----------------------+
| Tables in imooc_db    |
+-----------------------+
| customer_balance_log  |
| customer_inf          |
| customer_level_inf    |
| customer_login        |
| customer_login_log    |
| customer_point_log    |
| order_cart            |
| order_customer_addr   |
| order_detail          |
| order_master          |
| product_brand_info    |
| product_category      |
| product_comment       |
| product_info          |
| product_pic_info      |
| product_supplier_info |
| region_info           |
| shipping_info         |
| warehouse_info        |
| warehouse_proudct     |
+-----------------------+
20 rows in set (0.00 sec)mysql> delete from order_master;
Query OK, 10 rows affected (0.02 sec)mysql> select * from order_master;
Empty set (0.01 sec)mysql> INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,distoney,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, 
ustomer_id,shipping_user,province,city,district,address,payment_method,order_money,district_money,shipping_money,payment_money,shippme,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time)  VALUES (1, 3, '雨昕', 1, 1, 1, '北京',NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, '2021-07-11 20:20:25');
INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_moipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time)', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, 
INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_moipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time)  京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, 
INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_moipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time)', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, 
INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_moipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time)  京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, 
INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_mo)mysql> INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,distoney,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, 
ey,shipping_money,payment_money,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_poALUES (1, 8, '雨昕', 1, 1, 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:20:25');
INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_moipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time)', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, 
INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,district_moipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_time)  京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, NULL, 
Query OK, 1 row affected (0.12 sec)mysql> INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,distoney,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, 
Query OK, 1 row affected (0.11 sec)mysql> INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,distoney,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, 
Query OK, 1 row affected (0.11 sec)mysql> INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,distoney,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, 
Query OK, 1 row affected (0.11 sec)mysql> INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,distoney,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, 
Query OK, 1 row affected (0.12 sec)mysql> INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,distoney,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, 
Query OK, 1 row affected (0.12 sec)mysql> INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,distoney,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, 
Query OK, 1 row affected (0.11 sec)mysql> INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,distoney,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0, 
Query OK, 1 row affected (0.12 sec)mysql> INSERT INTO `order_master` (order_sn,customer_id,shipping_user,province,city,district,address,payment_method,order_money,distoney,shipping_comp_name,shipping_sn,create_time,shipping_time,pay_time,receive_time,order_status,order_point,invoice_title,modified_ 1, '北京', 1, 10.00, 0.00, 0.00, 0.00, NULL, NULL, '2021-07-11 20:20:25', NULL, '2021-07-11 20:18:55', '2021-07-11 20:18:59', 0, 0,
Query OK, 1 row affected (0.11 sec)mysql> select customer_id,order_sn,order_id  from order_master order by order_id;
+-------------+----------+----------+
| customer_id | order_sn | order_id |
+-------------+----------+----------+
|           1 |        1 |        2 |
|           2 |        2 |        3 |
|           3 |        1 |        4 |
|           4 |        1 |        5 |
|           5 |        1 |        6 |
|           6 |        1 |        7 |
|           7 |        1 |        8 |
|           8 |        1 |        9 |
|           9 |        1 |       10 |
|          10 |        1 |       11 |
+-------------+----------+----------+
10 rows in set (0.03 sec)mysql> 

下一篇:企业实战_17_MyCat水平扩展_跨分片查询_ER分片
https://gblfy.blog.csdn.net/article/details/100066013

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

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

相关文章

微服务精华问答 | 如何理解中台战略和微服务

戳蓝字“CSDN云计算”关注我们哦&#xff01;微服务(Microservice Architecture)是近几年流行的一种架构思想,关于它的概念很难一言以蔽之。今天&#xff0c;就让我们来看看关于微服务更加有深度的问题吧。1Q&#xff1a;什么是微服务A&#xff1a;1&#xff09;一组小的服务&a…

php 对象转换成数组,PHP把对象转换为数组的问题

原始对象object(Qiniu\Http\Error)#24 (2) {["url":"Qiniu\Http\Error":private]>string(25) "http://rs.qbox.me/buckets"["response":"Qiniu\Http\Error":private]>object(Qiniu\Http\Response)#25 (6) {["sta…

华为内测基于Android 10.0的EMUI 10系统;2019年Q1真无线耳机市场份额,苹果占半壁江山……...

关注并标星星CSDN云计算极客头条&#xff1a;速递、最新、绝对有料。这里有企业新动、这里有业界要闻&#xff0c;打起十二分精神&#xff0c;紧跟fashion你可以的&#xff01;每周三次&#xff0c;打卡即read更快、更全了解泛云圈精彩newsgo go go 苹果获得悬停手势专利 可隔空…

企业实战_17_MyCat水平扩展_跨分片查询_ER分片

接上一篇&#xff1a;企业实战_16_MyCat全局自增ID https://blog.csdn.net/weixin_40816738/article/details/100064315 案例比较&#xff1a; 在垂直拆分场景中&#xff0c;针对字段个数少的类型为字典类型的表&#xff0c;我们可以使用全局表的方式解决。 在水平扩展场景中&a…

bmob php支付,支付服务 - 支付服务RESTful 开发文档 - 《Bmob 文档中心》 - 书栈网 · BookStack...

注意&#xff1a;目前支付宝无法使用&#xff0c;请用户暂时不要接入&#xff0c;等待官方的恢复公告&#xff01;打款需知1.打款前请先在控制台填写以下信息2.每月的1、2、16、17号为申请打款时间&#xff0c;15号、月尾日为打款时间&#xff0c;确保用户有半个月的追诉期。Bm…

企业实战_22_MyCatSQL拦截

接上一篇&#xff1a;企业实战_21_MyCat_keepalived 安装配置验证 https://gblfy.blog.csdn.net/article/details/100073474 Mycat SQL拦截应用场景&#xff0c;可以指定监控的sql类型 文章目录1. 在server.xml文件中添加sql拦截属性标签2. 测试验证3. 查看sql拦截监控日志1. 在…

MongoDB凭什么跻身数据库排行前五?

戳蓝字“CSDN云计算”关注我们哦&#xff01;作者 | 孙浩峰DB-Engines 数据库流行度排行榜发布了5 月份的数据&#xff0c;前六名的排名“千年不变”&#xff0c;分别是&#xff1a;Oracle、MySQL、Microsoft SQL Server、PostgreSQL、MongoDB 和IBM Db2。而其中&#xff0c;Mo…

PHP字符串运算结果,PHP 实现后缀表达式(接受四则运算字符串,输出计算结果,附代码)...

最近接触了一个有趣的需求&#xff1a;给定变量a、b、c、d等若干&#xff0c;要求由用户输入的普通四则运算字符串(包含加减乘除括号)&#xff0c;算出具体的值。例如&#xff0c;a1&#xff0c;b2&#xff0c;c3&#xff0c;d4&#xff0c;给出 ab/(d-c)&#xff0c;应计算出结…

企业实战_23_MyCat SQL防火墙

接上一篇&#xff1a;企业实战_22_MyCatSQL拦截 https://blog.csdn.net/weixin_40816738/article/details/100073474 文章目录1. SQL防火墙_白名单配置2. 白名单测试3. SQL防火墙_黑名单配置4. SQL防火墙_黑名单测试SQL防火墙&#xff1a;包括2个标签<whitehost></whi…

同样是消息队列,Kafka凭什么速度那么快?

戳蓝字“CSDN云计算”关注我们哦&#xff01;作者 | 邴越来源 | 技术琐话Kafka的消息是保存或缓存在磁盘上的&#xff0c;一般认为在磁盘上读写数据是会降低性能的&#xff0c;因为寻址会比较消耗时间&#xff0c;但是实际上&#xff0c;Kafka的特性之一就是高吞吐率。即使是普…

企业实战_10_Mycat集成ZK实现配置同步

主机名IP地址角色数据库mycat192.168.43.32MYCAT ,MYSQL,ZKmycat&#xff08;全局自增id&#xff09;node1192.168.43.104ZKMYSQLorder_db01和order_db01node2192.168.43.217ZK,MYSQLorder_db03和order_db04node3192.168.43.172MYCAT ,MYSQLmycat&#xff08;全局自增id&#x…

亚马逊重组游戏开发部门:数个未发布游戏被“扼杀”;台积电明年开始为苹果iPhone生产5nm处理器……...

关注并标星星CSDN云计算极客头条&#xff1a;速递、最新、绝对有料。这里有企业新动、这里有业界要闻&#xff0c;打起十二分精神&#xff0c;紧跟fashion你可以的&#xff01;每周三次&#xff0c;打卡即read更快、更全了解泛云圈精彩newsgo go go 盒马送餐机器人、无人化再进…

psp中java,PSP编程概述

元旦准备买NDS&#xff0c;顺带关注了下PSP&#xff0c;其实是想&#xff0c;或许买PSP也不错~PSP很像一个平台&#xff0c;提供了很多东西&#xff0c;譬如官方的PS模拟器~在上面编程也是个不错的想法。国外的一个网站提供了很多信息&#xff0c;PS2Dev Network (http://www.p…

企业实战_18_MyCat_ZK集群安装部署

接上一篇&#xff1a;企业实战_17_MyCat水平扩展_跨分片查询_ER分片 https://gblfy.blog.csdn.net/article/details/100066013 文章目录一、使用ZK记录Mycat的配置1. 操作步骤2. 服务器部署分布二、zk集群安装部署2.1. 安装jdk并验证2.2. ZK下载2.3. node1下载同步zk2.4. 基础配…

分布式精华问答 | 分布式与集群的区别是什么?

什么是分布式计算&#xff1f;所谓分布式计算是一门计算机科学&#xff0c;它研究如何把一个需要非常巨大的计算能力才能解决的问题分成许多小的部分&#xff0c;然后把这些部分分配给许多计算机进行处理&#xff0c;最后把这些计算结果综合起来得到最终的结果。1Q&#xff1a;…

php模板解析引擎 单独,ThinkPHP模板引擎实现和常见问题

模板引擎由来早期做PHP开发WEB应用都是把PHP代码和HTML模板混在一起&#xff0c;模板引擎的诞生主要就是为了解决后端与前端的完全分离(现在来看其实是属于不完全分离)的问题&#xff0c;让开发与美工可以分工合作(虽然实际上最终模板工作大多仍然是由后端开发人员完成)&#x…

Mycat设置开机自启

接上一篇&#xff1a;实战_21_Mycat_MySql更新数据库失败 --read-only https://blog.csdn.net/weixin_40816738/article/details/100059688 下载mycat wget http://dl.mycat.io/1.6.5/Mycat-server-1.6.5-release-20180122220033-linux.tar.gz解压即安装mycat tar -zxf Mycat…

最近,京东AR又爆出哪般神奇?

戳蓝字“CSDN云计算”关注我们哦&#xff01;作者 | 刘晶晶只用一部手机就可在线“试用”口红&#xff0c;效果堪比美妆男主李佳琪&#xff0c;厉不厉害&#xff1f;只要轻轻一点就可一目了然购买的家具在家中摆放的效果怎样&#xff0c;神不神奇&#xff1f;时间飞快&#xff…

zookeeper开机自启动

编辑rc.local vim /etc/rc.d/rc.local2.需要指定jdk路径以及zookeeper启动路径 export JAVA_HOME/app/jdk1.8.0_144 /app/zookeeper-3.4.11/bin/zkServer.sh start3. 启动zookeeper cd /app/zookeeper-3.4.11/bin ./zkServer.sh start查看zk启动状态 /app/zookeeper-3.4.11…

绘制曲线 matlab,matlab绘制曲线图文

二维图形 三维图形 特殊二、三维图形 图形处理 实例 - 1 1.曲线图 Matlab作图是通过描点、连线来实现的,故在 画一个曲线图形之前,必须先取得该图形上的一系 ......例1 在0≤x≤2区间内,绘制曲线 y2e- MATLAB绘图 二维数据曲线图...第5讲 MATLAB绘图 电气工程系 李颖琼 6.1.1绘…