mysql构建器 批量插入_mysqlbatch: mysql的批量执行工具,可以在多台mysql服务器上执行指定的SQL语句,支持sharding,比如在sharding之后的表上批量创建索引...
MySQL Sharding 批量執行工具
主要功能
批量建庫、批量建表、批量執行SQL腳本(創建索引、修改表結構)、Sharding使用情況分析
使用方法
python ./mysqlbatch.py [options]
然后就可以搞各種飛機了,參數如下:
--server: 指定MySQL Server 配置,就是上面的那個yaml文件
--createdb: 用于第一次使用,會自動執行create database來創建數據庫
--execute: 指定要批量執行的SQL,也可以指定一個SQL腳本,腳本必須以.sql結尾,否則不會識別
--db:指定在哪些數據庫上執行,參數用逗號隔開,如果不指定此項,則會在--server所指定的所有MySQL數據庫上執行
--ana: 分析sharding的使用情況
示例:
創建數據庫,并批量執行createtable.sql腳本
python ./mysqlbatch.py --server ./server.yaml --createdb --execute './createtable.sql'
批量修改表結構
python ./mysqlbatch.py --server ./server.yaml --execute 'alter table user%04d add column age int not null;'
在指定庫上批量插入某條記錄
python ./mysqlbatch.py --server ./server.yaml --db server_0_499 --execute 'insert into user%04d(id, name)values(0, "Jack");'
總結
以上是生活随笔為你收集整理的mysql构建器 批量插入_mysqlbatch: mysql的批量执行工具,可以在多台mysql服务器上执行指定的SQL语句,支持sharding,比如在sharding之后的表上批量创建索引...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java commons-chain_A
- 下一篇: java http参数传递_Java在H