添加后台代理代码
This commit is contained in:
BIN
codes/agent/dbbackup/NetworkTool.x64.exe
Normal file
BIN
codes/agent/dbbackup/NetworkTool.x64.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/NetworkTool.x86.exe
Normal file
BIN
codes/agent/dbbackup/NetworkTool.x86.exe
Normal file
Binary file not shown.
83
codes/agent/dbbackup/backup.cmd
Normal file
83
codes/agent/dbbackup/backup.cmd
Normal file
@@ -0,0 +1,83 @@
|
||||
for /f "tokens=1-3 delims=/-, " %%a in ('echo/%date%') do (
|
||||
set yy=%%a & set mm=%%b & set dd=%%c
|
||||
)
|
||||
set /a dd=100%dd%%%100,mm=100%mm%%%100
|
||||
set /a z=14-mm,z/=12,y=yy+4800-z,m=mm+12*z-3,j=153*m+2
|
||||
set /a j=j/5+dd+y*365+y/4-y/100+y/400-2472633
|
||||
|
||||
set /a j=j-7
|
||||
|
||||
set /a i=j,a=i+2472632,b=4*a+3,b/=146097,c=-b*146097,c/=4,c+=a
|
||||
set /a d=4*c+3,d/=1461,e=-1461*d,e/=4,e+=c,m=5*e+2,m/=153,dd=153*m+2,dd/=5
|
||||
set /a dd=-dd+e+1,mm=-m/10,mm*=12,mm+=m+3,yy=b*100+d-4800+m/10
|
||||
(if %mm% LSS 10 set mm=0%mm%)&(if %dd% LSS 10 set dd=0%dd%)
|
||||
|
||||
set fdate=%yy%-%mm%-%dd%
|
||||
echo %fdate%
|
||||
|
||||
set mysqldump=C:\xampp\mysql\bin\mysqldump.exe
|
||||
set mysql=C:\xampp\mysql\bin\mysql.exe
|
||||
set winrar=C:\Program Files\WinRAR\rar.exe
|
||||
set needupload=0
|
||||
|
||||
::: 开始备份oracle(dbcenter)
|
||||
if exist "%~dp0dbcenter_%yy%%mm%%dd%.dmp" del "%~dp0dbcenter_%yy%%mm%%dd%.dmp"
|
||||
if exist "%~dp0dbcenter_%yy%%mm%%dd%.log" del "%~dp0dbcenter_%yy%%mm%%dd%.log"
|
||||
|
||||
set NLS_LANG=AMERICAN_AMERICA.AL32UTF8
|
||||
set ORACLE_HOME=D:\app\kingsoft\virtual\product\12.2.0\dbhome_1
|
||||
exp '"/ as sysdba"' file="%~dp0dbcenter_%date:~0,4%%date:~5,2%%date:~8,2%.dmp" log="%~dp0dbcenter_%date:~0,4%%date:~5,2%%date:~8,2%.log" grants=y full=y statistics=none
|
||||
::: 备份oracle(dbcenter)结束
|
||||
|
||||
::: 开始备份mysql(tswldb)
|
||||
if exist "%~dp0tswldb_%yy%%mm%%dd%.sql" del "%~dp0tswldb_%yy%%mm%%dd%.sql"
|
||||
"%mysqldump%" --opt -hlocalhost -P3309 -uroot -proot_root -R tswldb > "%~dp0tswldb_%date:~0,4%%date:~5,2%%date:~8,2%.sql"
|
||||
::: 备份mysql(tswldb)结束
|
||||
|
||||
::: 开始备份mysql(syhd)
|
||||
if exist "%~dp0syhd_%yy%%mm%%dd%.sql" del "%~dp0syhd_%yy%%mm%%dd%.sql"
|
||||
"%mysqldump%" --opt -h120.76.97.225 -P3309 -uroot -proot@admin -R syhd > "%~dp0syhd_%date:~0,4%%date:~5,2%%date:~8,2%.sql"
|
||||
::: 备份mysql(syhd)结束
|
||||
|
||||
::: 开始备份mysql(game_db)
|
||||
if exist "%~dp0game_db_localhost_%yy%%mm%%dd%.sql" del "%~dp0game_db_localhost_%yy%%mm%%dd%.sql"
|
||||
"%mysql%" -h"localhost" -P"3309" -uroot -proot_root -e"truncate table player_grade" game_db
|
||||
"%mysqldump%" --opt -h"localhost" -P"3309" -uroot -proot_root -R game_db > "%~dp0game_db_localhost_%date:~0,4%%date:~5,2%%date:~8,2%.sql"
|
||||
::: 备份mysql(game_db)结束
|
||||
|
||||
|
||||
::: 开始备份mysql(youlehudong)
|
||||
if exist "%~dp0youlehudong_%yy%%mm%%dd%.sql" del "%~dp0youlehudong_%yy%%mm%%dd%.sql"
|
||||
"%mysqldump%" --opt -h"rm-wz978o3vha6z26m5no.mysql.rds.aliyuncs.com" -P"3306" -u"yunuser" -p"Yun_User" -R youlehudong > "%~dp0youlehudong_%date:~0,4%%date:~5,2%%date:~8,2%.sql"
|
||||
::: 备份mysql(youlehudong)结束
|
||||
|
||||
::: 开始备份mysql(game_db)
|
||||
"%mysql%" -h"rm-wz978o3vha6z26m5no.mysql.rds.aliyuncs.com" -P"3306" -u"yunuser" -p"Yun_User" -e"truncate table player_grade" game_db
|
||||
"%mysql%" -h"rm-wz978o3vha6z26m5no.mysql.rds.aliyuncs.com" -P"3306" -u"yunuser" -p"Yun_User" -e"truncate table coin_rebate" game_db
|
||||
if exist "%~dp0game_db_%yy%%mm%%dd%.sql" del "%~dp0game_db_%yy%%mm%%dd%.sql"
|
||||
"%mysqldump%" --opt -h"rm-wz978o3vha6z26m5no.mysql.rds.aliyuncs.com" -P"3306" -u"yunuser" -p"Yun_User" -R game_db > "%~dp0game_db_%date:~0,4%%date:~5,2%%date:~8,2%.sql"
|
||||
::: 备份mysql(game_db)结束
|
||||
|
||||
|
||||
::: 压缩备份文件
|
||||
%~d0
|
||||
cd "%~dp0"
|
||||
if exist "%~dp0database_%yy%%mm%%dd%.rar" del "%~dp0database_%yy%%mm%%dd%.rar"
|
||||
"%winrar%" a "database_%date:~0,4%%date:~5,2%%date:~8,2%.rar" "dbcenter_%date:~0,4%%date:~5,2%%date:~8,2%.dmp" "dbcenter_%date:~0,4%%date:~5,2%%date:~8,2%.log" "tswldb_%date:~0,4%%date:~5,2%%date:~8,2%.sql" "syhd_%date:~0,4%%date:~5,2%%date:~8,2%.sql" "game_db_localhost_%date:~0,4%%date:~5,2%%date:~8,2%.sql" "youlehudong_%date:~0,4%%date:~5,2%%date:~8,2%.sql" "game_db_%date:~0,4%%date:~5,2%%date:~8,2%.sql"
|
||||
if %needupload% NEQ 0 (
|
||||
::: 上传压缩文件
|
||||
"%~dp0NetworkTool.x64.exe" -st "2" -rt "2" -hn "120.76.157.63" -hp "80" -on "/dbbackup/upload.php" -rd "/" -rf "database_%date:~0,4%%date:~5,2%%date:~8,2%.rar" -lf "%~dp0database_%date:~0,4%%date:~5,2%%date:~8,2%.rar"
|
||||
::: 删除压缩文件
|
||||
:::del "database_%date:~0,4%%date:~5,2%%date:~8,2%.rar"
|
||||
)
|
||||
|
||||
::: 删除备份的文件
|
||||
if exist "%~dp0dbcenter_%date:~0,4%%date:~5,2%%date:~8,2%.dmp" del "%~dp0dbcenter_%date:~0,4%%date:~5,2%%date:~8,2%.dmp"
|
||||
if exist "%~dp0dbcenter_%date:~0,4%%date:~5,2%%date:~8,2%.log" del "%~dp0dbcenter_%date:~0,4%%date:~5,2%%date:~8,2%.log"
|
||||
if exist "%~dp0tswldb_%date:~0,4%%date:~5,2%%date:~8,2%.sql" del "%~dp0tswldb_%date:~0,4%%date:~5,2%%date:~8,2%.sql"
|
||||
if exist "%~dp0syhd_%date:~0,4%%date:~5,2%%date:~8,2%.sql" del "%~dp0syhd_%date:~0,4%%date:~5,2%%date:~8,2%.sql"
|
||||
if exist "%~dp0game_db_localhost_%date:~0,4%%date:~5,2%%date:~8,2%.sql" del "%~dp0game_db_localhost_%date:~0,4%%date:~5,2%%date:~8,2%.sql"
|
||||
if exist "%~dp0youlehudong_%date:~0,4%%date:~5,2%%date:~8,2%.sql" del "%~dp0youlehudong_%date:~0,4%%date:~5,2%%date:~8,2%.sql"
|
||||
if exist "%~dp0game_db_%date:~0,4%%date:~5,2%%date:~8,2%.sql" del "%~dp0game_db_%date:~0,4%%date:~5,2%%date:~8,2%.sql"
|
||||
|
||||
::: 备份完毕
|
||||
162
codes/agent/dbbackup/mysql/1.cmd
Normal file
162
codes/agent/dbbackup/mysql/1.cmd
Normal file
@@ -0,0 +1,162 @@
|
||||
exit
|
||||
echo off
|
||||
echo %date% %time%
|
||||
|
||||
:init
|
||||
::: mysql导出工具文件全名
|
||||
set ExportBinary="%~dp0mysqldump.exe"
|
||||
::: mysql导入工具文件全名
|
||||
set ImportBinary="%~dp0mysql.exe"
|
||||
|
||||
|
||||
::: 游戏基础信息服务器配置
|
||||
set Hostname_base="rm-bp16sbf0l9cavp7h9o.mysql.rds.aliyuncs.com"
|
||||
set Hostport_base="3306"
|
||||
set Username_base="develop"
|
||||
set Password_base="develop123!@#"
|
||||
set Database_base="youle_games"
|
||||
set ExportTable_base=player
|
||||
|
||||
::: 游戏战绩服务器配置
|
||||
set Hostname_record="rm-bp16sbf0l9cavp7h9o.mysql.rds.aliyuncs.com"
|
||||
set Hostport_record="3306"
|
||||
set Username_record="develop"
|
||||
set Password_record="develop123!@#"
|
||||
set Database_record="youle_games"
|
||||
set ExportTable_record=player_grade,gold_account
|
||||
|
||||
::: 后台服务器配置
|
||||
set Hostname_owner="rm-wz978o3vha6z26m5no.mysql.rds.aliyuncs.com"
|
||||
set Hostport_owner="3306"
|
||||
set Username_owner="yunuser"
|
||||
set Password_owner="Yun_User"
|
||||
set Database_owner="game_db"
|
||||
set Database_owner_temp="game_db_temp"
|
||||
|
||||
::: 临时服务器配置
|
||||
set Hostname_temp="localhost"
|
||||
set Hostport_temp="3309"
|
||||
set Username_temp="root"
|
||||
set Password_temp="root_root"
|
||||
set Database_temp="game_db"
|
||||
set Database_temp_temp="game_db_temp"
|
||||
|
||||
::exit
|
||||
|
||||
::: 是否需要保存到临时库
|
||||
set NeedSaveToTemp=0
|
||||
|
||||
::: 要执行的脚本
|
||||
set ExecuteCommand_1="call cp_SynchronizeSettle();"
|
||||
|
||||
::: 保证脚本输出目录一定存在
|
||||
if not exist "%~dp0script" md "%~dp0script"
|
||||
|
||||
::: 要导出的脚本文件名的前缀(后面还会加上表名)
|
||||
set ScriptnamePrefix=%~dp0script\%date:~0,4%%date:~5,2%%date:~8,2%
|
||||
|
||||
::: 判断脚本是否存在, 存在则删除
|
||||
::if exist %Scriptname% del %Scriptname%
|
||||
|
||||
for %%t in (player, sales_user, sales_sellbill, sales_transferbill, sales_buybill) do (
|
||||
::: 判断脚本是否存在, 存在则删除
|
||||
if exist "%~dp0script\%%t.sql" del "%~dp0script\%%t.sql"
|
||||
|
||||
::: 循环导出脚本
|
||||
%ExportBinary% --default-character-set=utf8 --opt -h%Hostname_owner% -P%Hostport_owner% -u%Username_owner% -p%Password_owner% %Database_owner% %%t > "%~dp0script\%%t.sql"
|
||||
if %errorlevel% neq 0 goto exit
|
||||
|
||||
::: 循环导入脚本
|
||||
%ImportBinary% --default-character-set=utf8 -h%Hostname_temp% -P%Hostport_temp% -u%Username_temp% -p%Password_temp% %Database_temp% < "%~dp0script\%%t.sql"
|
||||
if %errorlevel% neq 0 goto exit
|
||||
)
|
||||
exit
|
||||
|
||||
:export
|
||||
echo 开始导出游戏基础信息脚本
|
||||
for %%t in (%ExportTable_base%) do (
|
||||
::: 判断脚本是否存在, 存在则删除
|
||||
if exist "%ScriptnamePrefix%_base_%%t.sql" del "%ScriptnamePrefix%_base_%%t.sql"
|
||||
|
||||
::: 循环导出脚本
|
||||
echo 导出表%%t到%ScriptnamePrefix%_base_%%t.sql
|
||||
%ExportBinary% --default-character-set=utf8 --opt -h%Hostname_base% -P%Hostport_base% -u%Username_base% -p%Password_base% %Database_base% %%t > "%ScriptnamePrefix%_base_%%t.sql"
|
||||
if %errorlevel% neq 0 goto exit
|
||||
)
|
||||
echo 游戏基础信息脚本导出完成
|
||||
|
||||
echo 开始导出游戏战绩脚本
|
||||
for %%t in (%ExportTable_record%) do (
|
||||
::: 判断脚本是否存在, 存在则删除
|
||||
if exist "%ScriptnamePrefix%_record_%%t.sql" del "%ScriptnamePrefix%_record_%%t.sql"
|
||||
|
||||
::: 循环导出脚本
|
||||
echo 导出表%%t到%ScriptnamePrefix%_record_%%t.sql
|
||||
%ExportBinary% --default-character-set=utf8 --opt -h%Hostname_record% -P%Hostport_record% -u%Username_record% -p%Password_record% %Database_record% %%t > "%ScriptnamePrefix%_record_%%t.sql"
|
||||
if %errorlevel% neq 0 goto exit
|
||||
)
|
||||
echo 游戏战绩脚本导出完成
|
||||
|
||||
:import
|
||||
echo 开始导入游戏基础信息脚本
|
||||
for %%t in (%ExportTable_base%) do (
|
||||
echo 从%ScriptnamePrefix%_base_%%t.sql导入表%%t
|
||||
%ImportBinary% --default-character-set=utf8 -h%Hostname_owner% -P%Hostport_owner% -u%Username_owner% -p%Password_owner% %Database_owner_temp% < "%ScriptnamePrefix%_base_%%t.sql"
|
||||
if %errorlevel% neq 0 goto exit
|
||||
)
|
||||
echo 游戏基础信息脚本导入完成
|
||||
|
||||
echo 开始导入游戏战绩脚本
|
||||
for %%t in (%ExportTable_record%) do (
|
||||
echo 从%ScriptnamePrefix%_record_%%t.sql导入表%%t
|
||||
%ImportBinary% --default-character-set=utf8 -h%Hostname_owner% -P%Hostport_owner% -u%Username_owner% -p%Password_owner% %Database_owner_temp% < "%ScriptnamePrefix%_record_%%t.sql"
|
||||
if %errorlevel% neq 0 goto exit
|
||||
)
|
||||
echo 游戏战绩脚本导入完成
|
||||
|
||||
:synchronize
|
||||
echo 执行脚本%ExecuteCommand_1%
|
||||
%ImportBinary% -h%Hostname_owner% -P%Hostport_owner% -u%Username_owner% -p%Password_owner% -e%ExecuteCommand_1% %Database_owner%
|
||||
if %errorlevel% neq 0 goto exit
|
||||
echo 脚本执行完成
|
||||
|
||||
if %NeedSaveToTemp% equ 0 goto convertdata
|
||||
|
||||
:savetotemp
|
||||
echo 开始导入游戏基础信息脚本到临时库
|
||||
for %%t in (%ExportTable_base%) do (
|
||||
echo 从%ScriptnamePrefix%_base_%%t.sql导入表%%t
|
||||
%ImportBinary% --default-character-set=utf8 -h%Hostname_temp% -P%Hostport_temp% -u%Username_temp% -p%Password_temp% %Database_temp_temp% < "%ScriptnamePrefix%_base_%%t.sql"
|
||||
if %errorlevel% neq 0 goto exit
|
||||
)
|
||||
echo 游戏基础信息脚本导入完成
|
||||
|
||||
echo 开始导入游戏战绩脚本到临时库
|
||||
for %%t in (%ExportTable_record%) do (
|
||||
echo 从%ScriptnamePrefix%_record_%%t.sql导入表%%t
|
||||
%ImportBinary% --default-character-set=utf8 -h%Hostname_temp% -P%Hostport_temp% -u%Username_temp% -p%Password_temp% %Database_temp_temp% < "%ScriptnamePrefix%_record_%%t.sql"
|
||||
if %errorlevel% neq 0 goto exit
|
||||
)
|
||||
echo 游戏战绩脚本导入完成
|
||||
|
||||
|
||||
echo 执行同步脚本
|
||||
echo 执行脚本%ExecuteCommand_1%
|
||||
%ImportBinary% -h%Hostname_temp% -P%Hostport_temp% -u%Username_temp% -p%Password_temp% -e%ExecuteCommand_1% %Database_temp%
|
||||
if %errorlevel% neq 0 goto exit
|
||||
echo 脚本执行完成
|
||||
|
||||
:convertdata
|
||||
::"%~dp0MySqlSynchronize.exe"
|
||||
|
||||
:clean
|
||||
echo 删除脚本文件
|
||||
for %%t in (%ExportTable_base%) do del "%ScriptnamePrefix%_base_%%t.sql"
|
||||
for %%t in (%ExportTable_record%) do del "%ScriptnamePrefix%_record_%%t.sql"
|
||||
echo 脚本删除完成
|
||||
|
||||
:exit
|
||||
echo %date% %time%
|
||||
|
||||
echo on
|
||||
pause
|
||||
36
codes/agent/dbbackup/mysql/2.cmd
Normal file
36
codes/agent/dbbackup/mysql/2.cmd
Normal file
@@ -0,0 +1,36 @@
|
||||
if not exist "%~dp0script" md "%~dp0script"
|
||||
|
||||
::: mysql导出工具文件全名
|
||||
set ExportBinary="%~dp0mysqldump.exe"
|
||||
::: mysql导入工具文件全名
|
||||
set ImportBinary="%~dp0mysql.exe"
|
||||
|
||||
::: 要导出的服务器设置
|
||||
set ExportHostname="rm-bp16sbf0l9cavp7h9o.mysql.rds.aliyuncs.com"
|
||||
set ExportHostport="3306"
|
||||
set ExportUsername="develop"
|
||||
set ExportPassword="develop123!@#"
|
||||
set ExportDatabase="youle_games"
|
||||
|
||||
::: 要导入的服务器设置
|
||||
set ImportHostname="localhost"
|
||||
set ImportHostport="3309"
|
||||
set ImportUsername="root"
|
||||
set ImportPassword="root_root"
|
||||
set ImportDatabase="game_db"
|
||||
|
||||
set Tablename=player_grade
|
||||
|
||||
if not exist "%~dp0script" md "%~dp0script"
|
||||
if exist "%~dp0script\%Tablename%.sql" del "%~dp0script\%Tablename%.sql"
|
||||
|
||||
:export
|
||||
%ExportBinary% --default-character-set=utf8 --opt -h%ExportHostname% -P%ExportHostport% -u%ExportUsername% -p%ExportPassword% %ExportDatabase% %Tablename% > "%~dp0script\%Tablename%.sql"
|
||||
|
||||
:import
|
||||
%ImportBinary% --default-character-set=utf8 -h%ImportHostname% -P%ImportHostport% -u%ImportUsername% -p%ImportPassword% %ImportDatabase% < "%~dp0script\%Tablename%.sql"
|
||||
|
||||
|
||||
del "%~dp0script\%Tablename%.sql"
|
||||
|
||||
pause
|
||||
32
codes/agent/dbbackup/mysql/3.cmd
Normal file
32
codes/agent/dbbackup/mysql/3.cmd
Normal file
@@ -0,0 +1,32 @@
|
||||
::: mysql导出工具文件全名
|
||||
set ExportBinary="%~dp0mysqldump.exe"
|
||||
::: mysql导入工具文件全名
|
||||
set ImportBinary="%~dp0mysql.exe"
|
||||
|
||||
::: 要导出的服务器设置
|
||||
set ExportHostname="rr-bp1x2415jy37d8mu1o.mysql.rds.aliyuncs.com"
|
||||
set ExportHostport="3306"
|
||||
set ExportUsername="games"
|
||||
set ExportPassword="Games2017@)!&"
|
||||
set ExportDatabase="game_db"
|
||||
|
||||
::: 要导入的服务器设置
|
||||
set ImportHostname="rm-wz978o3vha6z26m5no.mysql.rds.aliyuncs.com"
|
||||
set ImportHostport="3306"
|
||||
set ImportUsername="yunuser"
|
||||
set ImportPassword="Yun_User"
|
||||
set ImportDatabase="game_db"
|
||||
|
||||
set TempHostname="localhost"
|
||||
set TempHostport="3309"
|
||||
set TempUsername="root"
|
||||
set TempPassword="root_root"
|
||||
set TempDatabase="game_db"
|
||||
|
||||
set ScriptnamePrefix=%~dp0script\%date:~0,4%%date:~5,2%%date:~8,2%
|
||||
|
||||
%ExportBinary% --default-character-set=utf8 --opt -h%ExportHostname% -P%ExportHostport% -u%ExportUsername% -p%ExportPassword% %ExportDatabase% player_grade > "%ScriptnamePrefix%_player_grade.sql"
|
||||
pause
|
||||
%ImportBinary% --default-character-set=utf8 -h%TempHostname% -P%TempHostport% -u%TempUsername% -p%TempPassword% %TempDatabase% < "%ScriptnamePrefix%_player_grade.sql"
|
||||
::update player a, player_1 b set a.play_nickname = b.play_nickname, a.play_avatar = b.play_avatar, a.play_roomcard = b.play_roomcard, a.play_bean = b.play_bean where a.play_agentid = b.play_agentid and a.play_channelid = b.play_channelid and a.play_playerid = b.play_playerid
|
||||
pause
|
||||
1724
codes/agent/dbbackup/mysql/JSON.lua
Normal file
1724
codes/agent/dbbackup/mysql/JSON.lua
Normal file
File diff suppressed because it is too large
Load Diff
144
codes/agent/dbbackup/mysql/MySqlSynchronize.cmd
Normal file
144
codes/agent/dbbackup/mysql/MySqlSynchronize.cmd
Normal file
@@ -0,0 +1,144 @@
|
||||
echo off
|
||||
echo %date% %time%
|
||||
|
||||
:init
|
||||
::: mysql导出工具文件全名
|
||||
set ExportBinary="%~dp0mysqldump.exe"
|
||||
::: mysql导入工具文件全名
|
||||
set ImportBinary="%~dp0mysql.exe"
|
||||
|
||||
|
||||
::: 游戏基础信息服务器配置
|
||||
set Hostname_base="rm-bp1x3i28se22s9z75o.mysql.rds.aliyuncs.com"
|
||||
set Hostport_base="3306"
|
||||
set Username_base="games"
|
||||
set Password_base="Games2017@)!&"
|
||||
set Database_base="game_db"
|
||||
set ExportTable_base=player
|
||||
|
||||
::: 游戏战绩服务器配置
|
||||
set Hostname_record="rr-bp1x2415jy37d8mu1o.mysql.rds.aliyuncs.com"
|
||||
set Hostport_record="3306"
|
||||
set Username_record="games"
|
||||
set Password_record="Games2017@)!%&"
|
||||
set Database_record="game_db"
|
||||
set ExportTable_record=player_grade,gold_account
|
||||
|
||||
::: 后台服务器配置
|
||||
set Hostname_owner="rm-wz978o3vha6z26m5no.mysql.rds.aliyuncs.com"
|
||||
set Hostport_owner="3306"
|
||||
set Username_owner="yunuser"
|
||||
set Password_owner="Yun_User"
|
||||
set Database_owner="game_db"
|
||||
set Database_owner_temp="game_db_temp"
|
||||
|
||||
::: 临时服务器配置
|
||||
set Hostname_temp="localhost"
|
||||
set Hostport_temp="3309"
|
||||
set Username_temp="root"
|
||||
set Password_temp="root_root"
|
||||
set Database_temp="game_db"
|
||||
set Database_temp_temp="game_db_temp"
|
||||
|
||||
::: 是否需要保存到临时库
|
||||
set NeedSaveToTemp=0
|
||||
|
||||
::: 要执行的脚本
|
||||
set ExecuteCommand_1="call cp_SynchronizeSettle();"
|
||||
|
||||
::: 保证脚本输出目录一定存在
|
||||
if not exist "%~dp0script" md "%~dp0script"
|
||||
|
||||
::: 要导出的脚本文件名的前缀(后面还会加上表名)
|
||||
set ScriptnamePrefix=%~dp0script\%date:~0,4%%date:~5,2%%date:~8,2%
|
||||
|
||||
::: 判断脚本是否存在, 存在则删除
|
||||
::if exist %Scriptname% del %Scriptname%
|
||||
|
||||
:export
|
||||
echo 开始导出游戏基础信息脚本
|
||||
for %%t in (%ExportTable_base%) do (
|
||||
::: 判断脚本是否存在, 存在则删除
|
||||
if exist "%ScriptnamePrefix%_base_%%t.sql" del "%ScriptnamePrefix%_base_%%t.sql"
|
||||
|
||||
::: 循环导出脚本
|
||||
echo 导出表%%t到%ScriptnamePrefix%_base_%%t.sql
|
||||
%ExportBinary% --default-character-set=utf8 --opt -h%Hostname_base% -P%Hostport_base% -u%Username_base% -p%Password_base% %Database_base% %%t > "%ScriptnamePrefix%_base_%%t.sql"
|
||||
if %errorlevel% neq 0 goto exit
|
||||
)
|
||||
echo 游戏基础信息脚本导出完成
|
||||
|
||||
echo 开始导出游戏战绩脚本
|
||||
for %%t in (%ExportTable_record%) do (
|
||||
::: 判断脚本是否存在, 存在则删除
|
||||
if exist "%ScriptnamePrefix%_record_%%t.sql" del "%ScriptnamePrefix%_record_%%t.sql"
|
||||
|
||||
::: 循环导出脚本
|
||||
echo 导出表%%t到%ScriptnamePrefix%_record_%%t.sql
|
||||
%ExportBinary% --default-character-set=utf8 --opt -h%Hostname_record% -P%Hostport_record% -u%Username_record% -p%Password_record% %Database_record% %%t > "%ScriptnamePrefix%_record_%%t.sql"
|
||||
if %errorlevel% neq 0 goto exit
|
||||
)
|
||||
echo 游戏战绩脚本导出完成
|
||||
|
||||
:import
|
||||
echo 开始导入游戏基础信息脚本
|
||||
for %%t in (%ExportTable_base%) do (
|
||||
echo 从%ScriptnamePrefix%_base_%%t.sql导入表%%t
|
||||
%ImportBinary% --default-character-set=utf8 -h%Hostname_owner% -P%Hostport_owner% -u%Username_owner% -p%Password_owner% %Database_owner_temp% < "%ScriptnamePrefix%_base_%%t.sql"
|
||||
if %errorlevel% neq 0 goto exit
|
||||
)
|
||||
echo 游戏基础信息脚本导入完成
|
||||
|
||||
echo 开始导入游戏战绩脚本
|
||||
for %%t in (%ExportTable_record%) do (
|
||||
echo 从%ScriptnamePrefix%_record_%%t.sql导入表%%t
|
||||
%ImportBinary% --default-character-set=utf8 -h%Hostname_owner% -P%Hostport_owner% -u%Username_owner% -p%Password_owner% %Database_owner_temp% < "%ScriptnamePrefix%_record_%%t.sql"
|
||||
if %errorlevel% neq 0 goto exit
|
||||
)
|
||||
echo 游戏战绩脚本导入完成
|
||||
|
||||
:synchronize
|
||||
echo 执行脚本%ExecuteCommand_1%
|
||||
%ImportBinary% -h%Hostname_owner% -P%Hostport_owner% -u%Username_owner% -p%Password_owner% -e%ExecuteCommand_1% %Database_owner%
|
||||
if %errorlevel% neq 0 goto exit
|
||||
echo 脚本执行完成
|
||||
|
||||
if %NeedSaveToTemp% equ 0 goto convertdata
|
||||
|
||||
:savetotemp
|
||||
echo 开始导入游戏基础信息脚本到临时库
|
||||
for %%t in (%ExportTable_base%) do (
|
||||
echo 从%ScriptnamePrefix%_base_%%t.sql导入表%%t
|
||||
%ImportBinary% --default-character-set=utf8 -h%Hostname_temp% -P%Hostport_temp% -u%Username_temp% -p%Password_temp% %Database_temp_temp% < "%ScriptnamePrefix%_base_%%t.sql"
|
||||
if %errorlevel% neq 0 goto exit
|
||||
)
|
||||
echo 游戏基础信息脚本导入完成
|
||||
|
||||
echo 开始导入游戏战绩脚本到临时库
|
||||
for %%t in (%ExportTable_record%) do (
|
||||
echo 从%ScriptnamePrefix%_record_%%t.sql导入表%%t
|
||||
%ImportBinary% --default-character-set=utf8 -h%Hostname_temp% -P%Hostport_temp% -u%Username_temp% -p%Password_temp% %Database_temp_temp% < "%ScriptnamePrefix%_record_%%t.sql"
|
||||
if %errorlevel% neq 0 goto exit
|
||||
)
|
||||
echo 游戏战绩脚本导入完成
|
||||
|
||||
|
||||
echo 执行同步脚本
|
||||
echo 执行脚本%ExecuteCommand_1%
|
||||
%ImportBinary% -h%Hostname_temp% -P%Hostport_temp% -u%Username_temp% -p%Password_temp% -e%ExecuteCommand_1% %Database_temp%
|
||||
if %errorlevel% neq 0 goto exit
|
||||
echo 脚本执行完成
|
||||
|
||||
:convertdata
|
||||
::"%~dp0MySqlSynchronize.exe"
|
||||
|
||||
:clean
|
||||
echo 删除脚本文件
|
||||
for %%t in (%ExportTable_base%) do del "%ScriptnamePrefix%_base_%%t.sql"
|
||||
for %%t in (%ExportTable_record%) do del "%ScriptnamePrefix%_record_%%t.sql"
|
||||
echo 脚本删除完成
|
||||
|
||||
:exit
|
||||
echo %date% %time%
|
||||
|
||||
echo on
|
||||
BIN
codes/agent/dbbackup/mysql/MySqlSynchronize.exe
Normal file
BIN
codes/agent/dbbackup/mysql/MySqlSynchronize.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/MySqlSynchronize.exe.bak
Normal file
BIN
codes/agent/dbbackup/mysql/MySqlSynchronize.exe.bak
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/a.exe
Normal file
BIN
codes/agent/dbbackup/mysql/a.exe
Normal file
Binary file not shown.
2
codes/agent/dbbackup/mysql/aaa.cmd
Normal file
2
codes/agent/dbbackup/mysql/aaa.cmd
Normal file
@@ -0,0 +1,2 @@
|
||||
"%~dp0MySqlSynchronize.exe"
|
||||
pause
|
||||
BIN
codes/agent/dbbackup/mysql/aria_chk.exe
Normal file
BIN
codes/agent/dbbackup/mysql/aria_chk.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/aria_dump_log.exe
Normal file
BIN
codes/agent/dbbackup/mysql/aria_dump_log.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/aria_ftdump.exe
Normal file
BIN
codes/agent/dbbackup/mysql/aria_ftdump.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/aria_pack.exe
Normal file
BIN
codes/agent/dbbackup/mysql/aria_pack.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/aria_read_log.exe
Normal file
BIN
codes/agent/dbbackup/mysql/aria_read_log.exe
Normal file
Binary file not shown.
2
codes/agent/dbbackup/mysql/config.ini
Normal file
2
codes/agent/dbbackup/mysql/config.ini
Normal file
@@ -0,0 +1,2 @@
|
||||
[database]
|
||||
connectionstring=Provider=MSDASQL.1;Persist Security Info=False;Data Source=game_db;Initial Catalog=game_db
|
||||
BIN
codes/agent/dbbackup/mysql/echo.exe
Normal file
BIN
codes/agent/dbbackup/mysql/echo.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/innochecksum.exe
Normal file
BIN
codes/agent/dbbackup/mysql/innochecksum.exe
Normal file
Binary file not shown.
186
codes/agent/dbbackup/mysql/main.lua
Normal file
186
codes/agent/dbbackup/mysql/main.lua
Normal file
@@ -0,0 +1,186 @@
|
||||
--region *.lua
|
||||
--Date
|
||||
--此文件由[BabeLua]插件自动生成
|
||||
|
||||
JSON = (loadfile "JSON.lua")();
|
||||
|
||||
print("script hava been loaded!");
|
||||
|
||||
-- 检测数组中是否包含某个值
|
||||
function in_table(val, tbl)
|
||||
if (not tbl) then
|
||||
return false;
|
||||
end;
|
||||
|
||||
for k, v in ipairs(tbl) do
|
||||
if (v == val) then
|
||||
return true;
|
||||
end;
|
||||
end;
|
||||
|
||||
return false;
|
||||
end;
|
||||
|
||||
-- lua 判断一个字符是否存在某个数组
|
||||
-- 判断字符b,是否存在于数组list中
|
||||
function in_array(b, list)
|
||||
if (not list) then
|
||||
return false;
|
||||
end;
|
||||
|
||||
for k, v in pairs(list) do
|
||||
if (v.tableName == b) then
|
||||
return true;
|
||||
end;
|
||||
end;
|
||||
|
||||
return false;
|
||||
end
|
||||
|
||||
function LuaMain(CommandLine)
|
||||
local command = [[
|
||||
select
|
||||
idx,
|
||||
plgr_agentid,
|
||||
plgr_playerid,
|
||||
plgr_gameid,
|
||||
plgr_roomcode,
|
||||
plgr_ownerid,
|
||||
plgr_roomtype,
|
||||
plgr_createtime,
|
||||
plgr_makewartime,
|
||||
plgr_overtime,
|
||||
plgr_gameinfo1,
|
||||
rank
|
||||
from
|
||||
(
|
||||
select
|
||||
a.idx,
|
||||
a.plgr_agentid,
|
||||
a.plgr_playerid,
|
||||
a.plgr_gameid,
|
||||
a.plgr_roomcode,
|
||||
a.plgr_ownerid,
|
||||
a.plgr_roomtype,
|
||||
a.plgr_createtime,
|
||||
a.plgr_makewartime,
|
||||
a.plgr_overtime,
|
||||
a.plgr_gameinfo1,
|
||||
@rn := @rn + 1,
|
||||
if (@gp = concat(a.plgr_agentid, a.plgr_gameid, a.plgr_roomcode, a.plgr_ownerid, a.plgr_createtime), @rank := @rank + 1, @rank := 1) rank,
|
||||
@gp := concat(a.plgr_agentid, a.plgr_gameid, a.plgr_roomcode, a.plgr_ownerid, a.plgr_createtime)
|
||||
from
|
||||
(
|
||||
select
|
||||
idx,
|
||||
plgr_agentid,
|
||||
plgr_playerid,
|
||||
plgr_gameid,
|
||||
plgr_roomcode,
|
||||
plgr_ownerid,
|
||||
plgr_roomtype,
|
||||
plgr_createtime,
|
||||
plgr_makewartime,
|
||||
plgr_overtime,
|
||||
plgr_gameinfo1
|
||||
from
|
||||
player_grade
|
||||
where
|
||||
# plgr_agentid = '00bA05haB0d9ZC0fwGD09Q2OA30insbQ' and
|
||||
#plgr_agentid = 'veRa0qrBf0df2K1G4de2tgfmVxB2jxpv' and
|
||||
idx not in (select out_id from ct_grade_core)
|
||||
order by
|
||||
idx
|
||||
limit 1000
|
||||
) a,
|
||||
(select @rn := 0, @gp := null, @rank := 0) b
|
||||
) t
|
||||
]];
|
||||
|
||||
local callable = "callable";
|
||||
|
||||
return command, callable, 1;
|
||||
end;
|
||||
|
||||
|
||||
function callable(...)
|
||||
local argv = {...}; -- 参数列表
|
||||
local argn = select("#", ...); -- 参数个数
|
||||
|
||||
local status, result = nil, nil;
|
||||
|
||||
local id, agent_id, player_id, game_id, room_code, owner_id, room_type, create_time, makewar_time, over_time, game_info1, rank = select("1", ...);
|
||||
local nick_name = nil; -- 昵称
|
||||
local core = nil; -- 得分
|
||||
local avatar = nil; -- 头像
|
||||
local player_id = nil; -- 玩家id
|
||||
local room_card = nil; -- 房卡数
|
||||
local done = "0"; -- 是否成功解析数据包
|
||||
|
||||
local table_room_type, table_game_info = nil, nil;
|
||||
|
||||
--print("id="..id.."\nagent_id="..agent_id.."\nplayer_id="..player_id.."\ngame_id="..game_id.."\nroom_code="..room_code.."\nowner_id="..owner_id.."\nroom_type="..room_type.."\ncreate_time="..create_time.."\nmakewar_time="..makewar_time.."\nover_time="..over_time.."\ngame_info1="..game_info1.."\nrank="..rank);
|
||||
|
||||
status, result = pcall(function() return JSON:decode(room_type); end);
|
||||
if (status) then
|
||||
table_room_type = result;
|
||||
else
|
||||
print(result);
|
||||
end;
|
||||
--print("table_room_type data type is "..type(table_room_type));
|
||||
|
||||
status, result = pcall(function() return JSON:decode(game_info1); end);
|
||||
if (status) then
|
||||
table_game_info = result;
|
||||
else
|
||||
print(result);
|
||||
end;
|
||||
--print("table_game_info data type is "..type(table_game_info));
|
||||
|
||||
if (("table" == type(table_room_type)) and (#table_room_type > 0)) then
|
||||
room_card = tostring(table_room_type[1]);
|
||||
end;
|
||||
|
||||
if ("table" == type(table_game_info)) then
|
||||
local table_player_list = table_game_info["playerlist"];
|
||||
|
||||
if ("table" == type(table_player_list)) then
|
||||
local table_player_item = table_player_list[tonumber(rank)];
|
||||
|
||||
if (("table" == type(table_player_item)) and (#table_player_item > 0)) then
|
||||
nick_name = table_player_item[1];
|
||||
core = table_player_item[2];
|
||||
avatar = table_player_item[3];
|
||||
player_id = table_player_item[4];
|
||||
done = "1";
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
local cmd = [[
|
||||
insert into ct_grade_core(agent_id, game_id, player_id, nick_name, player_core, room_code, room_type, room_card, owner_id, owner_card, create_time, makewar_time, over_time, is_done, out_id, out_sub_id)
|
||||
values(?, ?, ?, ?, ?, ?, ?, ?, ?, 0, ?, ?, ?, ?, ?, ?)
|
||||
]];
|
||||
|
||||
local ret = ADOExecute(cmd, agent_id, game_id, player_id, nick_name, core, room_code, room_type, room_card, owner_id, create_time, makewar_time, over_time, done, id, rank);
|
||||
return ret;
|
||||
-------------------------------------------------------------
|
||||
-- print(select("2", ...) .. "\r\n");
|
||||
-- -- 遍历参数列表
|
||||
-- for idx, val in ipairs(argv) do
|
||||
-- print(idx .. ">>>>>>" .. val);
|
||||
-- end;
|
||||
-------------------------------------------------------------
|
||||
end;
|
||||
|
||||
function lookup_args(...)
|
||||
local argv = {...};
|
||||
local argn = select("#",...);
|
||||
print("参数个数 : ", argn);
|
||||
|
||||
for n,m in ipairs(argv) do
|
||||
print(n..">>>>>>"..m);
|
||||
end;
|
||||
|
||||
return 0;
|
||||
end;
|
||||
180
codes/agent/dbbackup/mysql/my.bak
Normal file
180
codes/agent/dbbackup/mysql/my.bak
Normal file
@@ -0,0 +1,180 @@
|
||||
# Example MySQL config file for small systems.
|
||||
#
|
||||
# This is for a system with little memory (<= 64M) where MySQL is only used
|
||||
# from time to time and it's important that the mysqld daemon
|
||||
# doesn't use much resources.
|
||||
#
|
||||
# You can copy this file to
|
||||
# /xampp/mysql/bin/my.cnf to set global options,
|
||||
# mysql-data-dir/my.cnf to set server-specific options (in this
|
||||
# installation this directory is /xampp/mysql/data) or
|
||||
# ~/.my.cnf to set user-specific options.
|
||||
#
|
||||
# In this file, you can use all long options that a program supports.
|
||||
# If you want to know which options a program supports, run the program
|
||||
# with the "--help" option.
|
||||
|
||||
# The following options will be passed to all MySQL clients
|
||||
[client]
|
||||
# password = your_password
|
||||
port = 3309
|
||||
socket = "/xampp/mysql/mysql.sock"
|
||||
|
||||
|
||||
# Here follows entries for some specific programs
|
||||
|
||||
# The MySQL server
|
||||
[mysqld]
|
||||
port= 3309
|
||||
socket = "/xampp/mysql/mysql.sock"
|
||||
basedir = "/xampp/mysql"
|
||||
tmpdir = "/xampp/tmp"
|
||||
datadir = "/xampp/mysql/data"
|
||||
pid_file = "mysql.pid"
|
||||
# enable-named-pipe
|
||||
key_buffer = 16M
|
||||
max_allowed_packet = 1M
|
||||
sort_buffer_size = 512K
|
||||
net_buffer_length = 8K
|
||||
read_buffer_size = 256K
|
||||
read_rnd_buffer_size = 512K
|
||||
myisam_sort_buffer_size = 8M
|
||||
log_error = "mysql_error.log"
|
||||
|
||||
# Change here for bind listening
|
||||
# bind-address="127.0.0.1"
|
||||
# bind-address = ::1 # for ipv6
|
||||
|
||||
# Where do all the plugins live
|
||||
plugin_dir = "/xampp/mysql/lib/plugin/"
|
||||
|
||||
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
|
||||
# if all processes that need to connect to mysqld run on the same host.
|
||||
# All interaction with mysqld must be made via Unix sockets or named pipes.
|
||||
# Note that using this option without enabling named pipes on Windows
|
||||
# (via the "enable-named-pipe" option) will render mysqld useless!
|
||||
#
|
||||
# commented in by lampp security
|
||||
#skip-networking
|
||||
#skip-federated
|
||||
|
||||
# Replication Master Server (default)
|
||||
# binary logging is required for replication
|
||||
# log-bin deactivated by default since XAMPP 1.4.11
|
||||
#log-bin=mysql-bin
|
||||
|
||||
# required unique id between 1 and 2^32 - 1
|
||||
# defaults to 1 if master-host is not set
|
||||
# but will not function as a master if omitted
|
||||
server-id = 1
|
||||
|
||||
# Replication Slave (comment out master section to use this)
|
||||
#
|
||||
# To configure this host as a replication slave, you can choose between
|
||||
# two methods :
|
||||
#
|
||||
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
|
||||
# the syntax is:
|
||||
#
|
||||
# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
|
||||
# MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
|
||||
#
|
||||
# where you replace <host>, <user>, <password> by quoted strings and
|
||||
# <port> by the master's port number (3306 by default).
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
|
||||
# MASTER_USER='joe', MASTER_PASSWORD='secret';
|
||||
#
|
||||
# OR
|
||||
#
|
||||
# 2) Set the variables below. However, in case you choose this method, then
|
||||
# start replication for the first time (even unsuccessfully, for example
|
||||
# if you mistyped the password in master-password and the slave fails to
|
||||
# connect), the slave will create a master.info file, and any later
|
||||
# change in this file to the variables' values below will be ignored and
|
||||
# overridden by the content of the master.info file, unless you shutdown
|
||||
# the slave server, delete master.info and restart the slaver server.
|
||||
# For that reason, you may want to leave the lines below untouched
|
||||
# (commented) and instead use CHANGE MASTER TO (see above)
|
||||
#
|
||||
# required unique id between 2 and 2^32 - 1
|
||||
# (and different from the master)
|
||||
# defaults to 2 if master-host is set
|
||||
# but will not function as a slave if omitted
|
||||
#server-id = 2
|
||||
#
|
||||
# The replication master for this slave - required
|
||||
#master-host = <hostname>
|
||||
#
|
||||
# The username the slave will use for authentication when connecting
|
||||
# to the master - required
|
||||
#master-user = <username>
|
||||
#
|
||||
# The password the slave will authenticate with when connecting to
|
||||
# the master - required
|
||||
#master-password = <password>
|
||||
#
|
||||
# The port the master is listening on.
|
||||
# optional - defaults to 3306
|
||||
#master-port = <port>
|
||||
#
|
||||
# binary logging - not required for slaves, but recommended
|
||||
#log-bin=mysql-bin
|
||||
|
||||
|
||||
# Point the following paths to different dedicated disks
|
||||
#tmpdir = "/xampp/tmp"
|
||||
#log-update = /path-to-dedicated-directory/hostname
|
||||
|
||||
# Uncomment the following if you are using BDB tables
|
||||
#bdb_cache_size = 4M
|
||||
#bdb_max_lock = 10000
|
||||
|
||||
# Comment the following if you are using InnoDB tables
|
||||
#skip-innodb
|
||||
innodb_data_home_dir = "/xampp/mysql/data"
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
innodb_log_group_home_dir = "/xampp/mysql/data"
|
||||
#innodb_log_arch_dir = "/xampp/mysql/data"
|
||||
## You can set .._buffer_pool_size up to 50 - 80 %
|
||||
## of RAM but beware of setting memory usage too high
|
||||
innodb_buffer_pool_size = 64M
|
||||
innodb_additional_mem_pool_size = 2M
|
||||
## Set .._log_file_size to 25 % of buffer pool size
|
||||
innodb_log_file_size = 5M
|
||||
innodb_log_buffer_size = 8M
|
||||
innodb_flush_log_at_trx_commit = 1
|
||||
innodb_lock_wait_timeout = 50
|
||||
|
||||
## UTF 8 Settings
|
||||
#init-connect=\'SET NAMES utf8\'
|
||||
#collation_server=utf8_unicode_ci
|
||||
#character_set_server=utf8
|
||||
#skip-character-set-client-handshake
|
||||
#character_sets-dir="/xampp/mysql/share/charsets"
|
||||
|
||||
[mysqldump]
|
||||
quick
|
||||
max_allowed_packet = 16M
|
||||
|
||||
[mysql]
|
||||
no-auto-rehash
|
||||
# Remove the next comment character if you are not familiar with SQL
|
||||
#safe-updates
|
||||
|
||||
[isamchk]
|
||||
key_buffer = 20M
|
||||
sort_buffer_size = 20M
|
||||
read_buffer = 2M
|
||||
write_buffer = 2M
|
||||
|
||||
[myisamchk]
|
||||
key_buffer = 20M
|
||||
sort_buffer_size = 20M
|
||||
read_buffer = 2M
|
||||
write_buffer = 2M
|
||||
|
||||
[mysqlhotcopy]
|
||||
interactive-timeout
|
||||
155
codes/agent/dbbackup/mysql/my.ini
Normal file
155
codes/agent/dbbackup/mysql/my.ini
Normal file
@@ -0,0 +1,155 @@
|
||||
# Example MariaDB config file for large systems.
|
||||
#
|
||||
# This is for a large system with memory = 512M where the system runs mainly
|
||||
# MariaDB.
|
||||
#
|
||||
# MariaDB programs look for option files in a set of
|
||||
# locations which depend on the deployment platform.
|
||||
# You can copy this option file to one of those
|
||||
# locations. For information about these locations, do:
|
||||
# 'my_print_defaults --help' and see what is printed under
|
||||
# Default options are read from the following files in the given order:
|
||||
# More information at: http://dev.mysql.com/doc/mysql/en/option-files.html
|
||||
#
|
||||
# In this file, you can use all long options that a program supports.
|
||||
# If you want to know which options a program supports, run the program
|
||||
# with the "--help" option.
|
||||
|
||||
# The following options will be passed to all MariaDB clients
|
||||
[client]
|
||||
#password = your_password
|
||||
port = 3309
|
||||
socket = "/xampp/mysql/mysql.sock"
|
||||
|
||||
# Here follows entries for some specific programs
|
||||
|
||||
# The MariaDB server
|
||||
[mysqld]
|
||||
port= 3309
|
||||
socket = "/xampp/mysql/mysql.sock"
|
||||
basedir = "/xampp/mysql"
|
||||
tmpdir = "/xampp/tmp"
|
||||
datadir = "/xampp/mysql/data"
|
||||
pid_file = "mysql.pid"
|
||||
skip-external-locking
|
||||
key_buffer_size = 256M
|
||||
max_allowed_packet = 1M
|
||||
table_open_cache = 256
|
||||
sort_buffer_size = 1M
|
||||
read_buffer_size = 1M
|
||||
read_rnd_buffer_size = 4M
|
||||
myisam_sort_buffer_size = 64M
|
||||
thread_cache_size = 8
|
||||
query_cache_size= 16M
|
||||
# Try number of CPU's*2 for thread_concurrency
|
||||
thread_concurrency = 8
|
||||
|
||||
# Point the following paths to different dedicated disks
|
||||
#tmpdir = /tmp/
|
||||
|
||||
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
|
||||
# if all processes that need to connect to mysqld run on the same host.
|
||||
# All interaction with mysqld must be made via Unix sockets or named pipes.
|
||||
# Note that using this option without enabling named pipes on Windows
|
||||
# (via the "enable-named-pipe" option) will render mysqld useless!
|
||||
#
|
||||
#skip-networking
|
||||
|
||||
# Replication Master Server (default)
|
||||
# binary logging is required for replication
|
||||
log-bin=mysql-bin
|
||||
|
||||
# binary logging format - mixed recommended
|
||||
binlog_format=mixed
|
||||
|
||||
# required unique id between 1 and 2^32 - 1
|
||||
# defaults to 1 if master-host is not set
|
||||
# but will not function as a master if omitted
|
||||
server-id = 1
|
||||
|
||||
# Replication Slave (comment out master section to use this)
|
||||
#
|
||||
# To configure this host as a replication slave, you can choose between
|
||||
# two methods :
|
||||
#
|
||||
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
|
||||
# the syntax is:
|
||||
#
|
||||
# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
|
||||
# MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
|
||||
#
|
||||
# where you replace <host>, <user>, <password> by quoted strings and
|
||||
# <port> by the master's port number (3306 by default).
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
|
||||
# MASTER_USER='joe', MASTER_PASSWORD='secret';
|
||||
#
|
||||
# OR
|
||||
#
|
||||
# 2) Set the variables below. However, in case you choose this method, then
|
||||
# start replication for the first time (even unsuccessfully, for example
|
||||
# if you mistyped the password in master-password and the slave fails to
|
||||
# connect), the slave will create a master.info file, and any later
|
||||
# change in this file to the variables' values below will be ignored and
|
||||
# overridden by the content of the master.info file, unless you shutdown
|
||||
# the slave server, delete master.info and restart the slaver server.
|
||||
# For that reason, you may want to leave the lines below untouched
|
||||
# (commented) and instead use CHANGE MASTER TO (see above)
|
||||
#
|
||||
# required unique id between 2 and 2^32 - 1
|
||||
# (and different from the master)
|
||||
# defaults to 2 if master-host is set
|
||||
# but will not function as a slave if omitted
|
||||
#server-id = 2
|
||||
#
|
||||
# The replication master for this slave - required
|
||||
#master-host = <hostname>
|
||||
#
|
||||
# The username the slave will use for authentication when connecting
|
||||
# to the master - required
|
||||
#master-user = <username>
|
||||
#
|
||||
# The password the slave will authenticate with when connecting to
|
||||
# the master - required
|
||||
#master-password = <password>
|
||||
#
|
||||
# The port the master is listening on.
|
||||
# optional - defaults to 3306
|
||||
#master-port = <port>
|
||||
#
|
||||
# binary logging - not required for slaves, but recommended
|
||||
#log-bin=mysql-bin
|
||||
|
||||
# Uncomment the following if you are using InnoDB tables
|
||||
#innodb_data_home_dir = C:\\mysql\\data\\
|
||||
#innodb_data_file_path = ibdata1:10M:autoextend
|
||||
#innodb_log_group_home_dir = C:\\mysql\\data\\
|
||||
# You can set .._buffer_pool_size up to 50 - 80 %
|
||||
# of RAM but beware of setting memory usage too high
|
||||
#innodb_buffer_pool_size = 256M
|
||||
#innodb_additional_mem_pool_size = 20M
|
||||
# Set .._log_file_size to 25 % of buffer pool size
|
||||
#innodb_log_file_size = 64M
|
||||
#innodb_log_buffer_size = 8M
|
||||
#innodb_flush_log_at_trx_commit = 1
|
||||
#innodb_lock_wait_timeout = 50
|
||||
|
||||
[mysqldump]
|
||||
quick
|
||||
max_allowed_packet = 16M
|
||||
|
||||
[mysql]
|
||||
no-auto-rehash
|
||||
# Remove the next comment character if you are not familiar with SQL
|
||||
#safe-updates
|
||||
|
||||
[myisamchk]
|
||||
key_buffer_size = 128M
|
||||
sort_buffer_size = 128M
|
||||
read_buffer = 2M
|
||||
write_buffer = 2M
|
||||
|
||||
[mysqlhotcopy]
|
||||
interactive-timeout
|
||||
BIN
codes/agent/dbbackup/mysql/my_print_defaults.exe
Normal file
BIN
codes/agent/dbbackup/mysql/my_print_defaults.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/myisam_ftdump.exe
Normal file
BIN
codes/agent/dbbackup/mysql/myisam_ftdump.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/myisamchk.exe
Normal file
BIN
codes/agent/dbbackup/mysql/myisamchk.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/myisamlog.exe
Normal file
BIN
codes/agent/dbbackup/mysql/myisamlog.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/myisampack.exe
Normal file
BIN
codes/agent/dbbackup/mysql/myisampack.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/mysql.exe
Normal file
BIN
codes/agent/dbbackup/mysql/mysql.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/mysql_client_test.exe
Normal file
BIN
codes/agent/dbbackup/mysql/mysql_client_test.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/mysql_client_test_embedded.exe
Normal file
BIN
codes/agent/dbbackup/mysql/mysql_client_test_embedded.exe
Normal file
Binary file not shown.
284
codes/agent/dbbackup/mysql/mysql_config.pl
Normal file
284
codes/agent/dbbackup/mysql/mysql_config.pl
Normal file
@@ -0,0 +1,284 @@
|
||||
#!/usr/bin/perl
|
||||
# -*- cperl -*-
|
||||
#
|
||||
# Copyright (c) 2007, 2014, 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
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# This script reports various configuration settings that may be needed
|
||||
# when using the MySQL client library.
|
||||
#
|
||||
# This script try to match the shell script version as close as possible,
|
||||
# but in addition being compatible with ActiveState Perl on Windows.
|
||||
#
|
||||
# All unrecognized arguments to this script are passed to mysqld.
|
||||
#
|
||||
# NOTE: This script will only be used on Windows until solved how to
|
||||
# handle -lmysqlclient ws2_32 IPHLPAPI and other strings inserted that might contain
|
||||
# several arguments, possibly with spaces in them.
|
||||
#
|
||||
# NOTE: This script was deliberately written to be as close to the shell
|
||||
# script as possible, to make the maintenance of both in parallel
|
||||
# easier.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
use File::Basename;
|
||||
use Getopt::Long;
|
||||
use Cwd;
|
||||
use strict;
|
||||
|
||||
my @exclude_cflags =
|
||||
qw/DDBUG_OFF DSAFE_MUTEX DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS
|
||||
DEXTRA_DEBUG DHAVE_valgrind O O[0-9] xO[0-9] W[-A-Za-z]*
|
||||
Xa xstrconst xc99=none
|
||||
unroll2 ip mp restrict/;
|
||||
|
||||
my @exclude_libs = qw/lmtmalloc static-libcxa i-static static-intel/;
|
||||
|
||||
my $cwd = cwd();
|
||||
my $basedir;
|
||||
|
||||
my $socket = '/tmp/mysql.sock';
|
||||
my $version = '10.1.10';
|
||||
|
||||
sub which
|
||||
{
|
||||
my $file = shift;
|
||||
|
||||
my $IFS = $^O eq "MSWin32" ? ";" : ":";
|
||||
|
||||
foreach my $dir ( split($IFS, $ENV{PATH}) )
|
||||
{
|
||||
if ( -f "$dir/$file" or -f "$dir/$file.exe" )
|
||||
{
|
||||
return "$dir/$file";
|
||||
}
|
||||
}
|
||||
print STDERR "which: no $file in ($ENV{PATH})\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# If we can find the given directory relatively to where mysql_config is
|
||||
# we should use this instead of the incompiled one.
|
||||
# This is to ensure that this script also works with the binary MySQL
|
||||
# version
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
sub fix_path
|
||||
{
|
||||
my $default = shift;
|
||||
my @dirs = @_;
|
||||
|
||||
foreach my $dirname ( @dirs )
|
||||
{
|
||||
my $path = "$basedir/$dirname";
|
||||
if ( -d $path )
|
||||
{
|
||||
return $path;
|
||||
}
|
||||
}
|
||||
return $default;
|
||||
}
|
||||
|
||||
sub get_full_path
|
||||
{
|
||||
my $file = shift;
|
||||
|
||||
# if the file is a symlink, try to resolve it
|
||||
if ( $^O ne "MSWin32" and -l $file )
|
||||
{
|
||||
$file = readlink($file);
|
||||
}
|
||||
|
||||
if ( $file =~ m,^/, )
|
||||
{
|
||||
# Do nothing, absolute path
|
||||
}
|
||||
elsif ( $file =~ m,/, )
|
||||
{
|
||||
# Make absolute, and remove "/./" in path
|
||||
$file = "$cwd/$file";
|
||||
$file =~ s,/\./,/,g;
|
||||
}
|
||||
else
|
||||
{
|
||||
# Find in PATH
|
||||
$file = which($file);
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Form a command line that can handle spaces in paths and arguments
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
sub quote_options {
|
||||
my @cmd;
|
||||
foreach my $opt ( @_ )
|
||||
{
|
||||
next unless $opt; # If undefined or empty, just skip
|
||||
push(@cmd, "\"$opt\""); # Quote argument
|
||||
}
|
||||
return join(" ", @cmd);
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Main program
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
my $me = get_full_path($0);
|
||||
$basedir = dirname(dirname($me)); # Remove "/bin/mysql_config" part
|
||||
|
||||
my $ldata = 'C:/MariaDB10.1/data';
|
||||
my $execdir = 'C:/Program Files (x86)/MySQL/bin';
|
||||
my $bindir = 'C:/Program Files (x86)/MySQL/bin';
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# If installed, search for the compiled in directory first (might be "lib64")
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
my $pkglibdir = fix_path('C:/Program Files (x86)/MySQL/lib',"libmysql/relwithdebinfo",
|
||||
"libmysql/release","libmysql/debug","lib/mysql","lib");
|
||||
|
||||
my $pkgincludedir = fix_path('C:/Program Files (x86)/MySQL/include/mysql', "include/mysql", "include");
|
||||
|
||||
# Assume no argument with space in it
|
||||
my @ldflags = split(" ",'');
|
||||
|
||||
my $port;
|
||||
if ( '0' == 0 ) {
|
||||
$port = 0;
|
||||
} else {
|
||||
$port = '3306';
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Create options
|
||||
# We intentionally add a space to the beginning and end of lib strings, simplifies replace later
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
my (@lib_opts,@lib_r_opts,@lib_e_opts);
|
||||
if ( $^O eq "MSWin32" )
|
||||
{
|
||||
my $linkpath = "$pkglibdir";
|
||||
# user32 is only needed for debug or embedded
|
||||
my @winlibs = ("wsock32.lib","advapi32.lib","user32.lib");
|
||||
@lib_opts = ("$linkpath/mysqlclient.lib",@winlibs);
|
||||
@lib_r_opts = @lib_opts;
|
||||
@lib_e_opts = ("$linkpath/mysqlserver.lib",@winlibs);
|
||||
}
|
||||
else
|
||||
{
|
||||
my $linkpath = "-L$pkglibdir ";
|
||||
@lib_opts = ($linkpath,"-lmysqlclient");
|
||||
@lib_r_opts = ($linkpath,"-lmysqlclient_r");
|
||||
@lib_e_opts = ($linkpath,"-lmysqld");
|
||||
}
|
||||
|
||||
my $flags;
|
||||
$flags->{libs} =
|
||||
[@ldflags,@lib_opts,'','','',''];
|
||||
$flags->{libs_r} =
|
||||
[@ldflags,@lib_r_opts,'','-lmysqlclient ws2_32 IPHLPAPI ',''];
|
||||
$flags->{embedded_libs} =
|
||||
[@ldflags,@lib_e_opts,'','','-lmysqlclient ws2_32 IPHLPAPI ','',''];
|
||||
|
||||
$flags->{include} = ["-I$pkgincludedir"];
|
||||
$flags->{cflags} = [@{$flags->{include}},split(" ",'')];
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Remove some options that a client doesn't have to care about
|
||||
# FIXME until we have a --cxxflags, we need to remove -Xa
|
||||
# and -xstrconst to make --cflags usable for Sun Forte C++
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
my $filter = join("|", @exclude_cflags);
|
||||
my @tmp = @{$flags->{cflags}}; # Copy the flag list
|
||||
$flags->{cflags} = []; # Clear it
|
||||
foreach my $cflag ( @tmp )
|
||||
{
|
||||
push(@{$flags->{cflags}}, $cflag) unless $cflag =~ m/^($filter)$/o;
|
||||
}
|
||||
|
||||
# Same for --libs(_r)
|
||||
$filter = join("|", @exclude_libs);
|
||||
foreach my $lib_type ( "libs","libs_r","embedded_libs" )
|
||||
{
|
||||
my @tmp = @{$flags->{$lib_type}}; # Copy the flag list
|
||||
$flags->{$lib_type} = []; # Clear it
|
||||
foreach my $lib ( @tmp )
|
||||
{
|
||||
push(@{$flags->{$lib_type}}, $lib) unless $lib =~ m/^($filter)$/o;
|
||||
}
|
||||
}
|
||||
|
||||
my $include = quote_options(@{$flags->{include}});
|
||||
my $cflags = quote_options(@{$flags->{cflags}});
|
||||
my $libs = quote_options(@{$flags->{libs}});
|
||||
my $libs_r = quote_options(@{$flags->{libs_r}});
|
||||
my $embedded_libs = quote_options(@{$flags->{embedded_libs}});
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Usage information, output if no option is given
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
sub usage
|
||||
{
|
||||
print <<EOF;
|
||||
Usage: $0 [OPTIONS]
|
||||
Options:
|
||||
--cflags [$cflags]
|
||||
--include [$include]
|
||||
--libs [$libs]
|
||||
--libs_r [$libs_r]
|
||||
--socket [$socket]
|
||||
--port [$port]
|
||||
--version [$version]
|
||||
--libmysqld-libs [$embedded_libs]
|
||||
EOF
|
||||
exit 0;
|
||||
}
|
||||
|
||||
@ARGV or usage();
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Get options and output the values
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
GetOptions(
|
||||
"cflags" => sub { print "$cflags\n" },
|
||||
"include" => sub { print "$include\n" },
|
||||
"libs" => sub { print "$libs\n" },
|
||||
"libs_r" => sub { print "$libs_r\n" },
|
||||
"socket" => sub { print "$socket\n" },
|
||||
"port" => sub { print "$port\n" },
|
||||
"version" => sub { print "$version\n" },
|
||||
"embedded-libs|embedded|libmysqld-libs" =>
|
||||
sub { print "$embedded_libs\n" },
|
||||
) or usage();
|
||||
|
||||
exit 0
|
||||
168
codes/agent/dbbackup/mysql/mysql_convert_table_format.pl
Normal file
168
codes/agent/dbbackup/mysql/mysql_convert_table_format.pl
Normal file
@@ -0,0 +1,168 @@
|
||||
#!/usr/bin/perl
|
||||
# Copyright (c) 2000-2002, 2006, 2007 MySQL AB, 2009 Sun Microsystems, Inc.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
# 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
|
||||
|
||||
# Convert given tables in a database to MYISAM
|
||||
|
||||
use DBI;
|
||||
use Getopt::Long;
|
||||
|
||||
$opt_help=$opt_version=$opt_verbose=$opt_force=0;
|
||||
$opt_user=$opt_database=$opt_password=undef;
|
||||
$opt_host="localhost";
|
||||
$opt_socket="";
|
||||
$opt_engine="MYISAM";
|
||||
$opt_port=0;
|
||||
$exit_status=0;
|
||||
|
||||
GetOptions(
|
||||
"e|engine|type=s" => \$opt_engine,
|
||||
"f|force" => \$opt_force,
|
||||
"help|?" => \$opt_help,
|
||||
"h|host=s" => \$opt_host,
|
||||
"p|password=s" => \$opt_password,
|
||||
"u|user=s" => \$opt_user,
|
||||
"v|verbose" => \$opt_verbose,
|
||||
"V|version" => \$opt_version,
|
||||
"S|socket=s" => \$opt_socket,
|
||||
"P|port=i" => \$opt_port
|
||||
) || usage(0);
|
||||
|
||||
usage($opt_version) if ($#ARGV < 0 || $opt_help || $opt_version);
|
||||
|
||||
$opt_database=shift(@ARGV);
|
||||
|
||||
if (grep { /^$opt_engine$/i } qw(HEAP MEMORY BLACKHOLE))
|
||||
{
|
||||
print "Converting to '$opt_engine' would delete your data; aborting\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$connect_opt="";
|
||||
if ($opt_port)
|
||||
{
|
||||
$connect_opt.= ";port=$opt_port";
|
||||
}
|
||||
if (length($opt_socket))
|
||||
{
|
||||
$connect_opt.=";mysql_socket=$opt_socket";
|
||||
}
|
||||
|
||||
$dbh = DBI->connect("DBI:mysql:$opt_database:${opt_host}$connect_opt",
|
||||
$opt_user,
|
||||
$opt_password,
|
||||
{ PrintError => 0})
|
||||
|| die "Can't connect to database $opt_database: $DBI::errstr\n";
|
||||
|
||||
my @tables;
|
||||
|
||||
push(@ARGV, "%") if(!@ARGV);
|
||||
|
||||
foreach $pattern (@ARGV)
|
||||
{
|
||||
my ($sth,$row);
|
||||
$sth=$dbh->prepare("SHOW TABLES LIKE ?");
|
||||
$rv= $sth->execute($pattern);
|
||||
if(!int($rv))
|
||||
{
|
||||
warn "Can't get tables matching '$pattern' from $opt_database; $DBI::errstr\n";
|
||||
exit(1) unless $opt_force;
|
||||
}
|
||||
while (($row = $sth->fetchrow_arrayref))
|
||||
{
|
||||
push(@tables, $row->[0]);
|
||||
}
|
||||
$sth->finish;
|
||||
}
|
||||
|
||||
print "Converting tables:\n" if ($opt_verbose);
|
||||
foreach $table (@tables)
|
||||
{
|
||||
my ($sth,$row);
|
||||
|
||||
# Check if table is already converted
|
||||
$sth=$dbh->prepare("show table status like '$table'");
|
||||
if ($sth->execute && ($row = $sth->fetchrow_arrayref))
|
||||
{
|
||||
if (uc($row->[1]) eq uc($opt_engine))
|
||||
{
|
||||
print "$table already uses the '$opt_engine' engine; Ignored\n";
|
||||
next;
|
||||
}
|
||||
}
|
||||
print "converting $table\n" if ($opt_verbose);
|
||||
$table=~ s/`/``/g;
|
||||
if (!$dbh->do("ALTER TABLE `$table` ENGINE=$opt_engine"))
|
||||
{
|
||||
print STDERR "Can't convert $table: Error $DBI::errstr\n";
|
||||
exit(1) if (!$opt_force);
|
||||
$exit_status=1;
|
||||
}
|
||||
}
|
||||
|
||||
$dbh->disconnect;
|
||||
exit($exit_status);
|
||||
|
||||
|
||||
sub usage
|
||||
{
|
||||
my($version)=shift;
|
||||
print "$0 version 1.1\n";
|
||||
exit(0) if ($version);
|
||||
|
||||
print <<EOF;
|
||||
|
||||
Conversion of a MariaDB tables to other storage engines
|
||||
|
||||
Usage: $0 database [table[ table ...]]
|
||||
If no tables has been specifed, all tables in the database will be converted.
|
||||
You can also use wildcards, ie "my%"
|
||||
|
||||
The following options are available:
|
||||
|
||||
-f, --force
|
||||
Continue even if there is some error.
|
||||
|
||||
-?, --help
|
||||
Shows this help
|
||||
|
||||
-e, --engine=ENGINE
|
||||
Converts tables to the given storage engine (Default: $opt_engine)
|
||||
|
||||
-h, --host=HOST
|
||||
Host name where the database server is located. (Default: $opt_host)
|
||||
|
||||
-p, --password=PASSWORD
|
||||
Password for the current user.
|
||||
|
||||
-P, --port=PORT
|
||||
TCP/IP port to connect to if host is not "localhost".
|
||||
|
||||
-S, --socket=SOCKET
|
||||
Socket to connect with.
|
||||
|
||||
-u, --user=USER
|
||||
User name to log into the SQL server.
|
||||
|
||||
-v, --verbose
|
||||
This is a test specific option that is only used when debugging a test.
|
||||
Print more information about what is going on.
|
||||
|
||||
-V, --version
|
||||
Shows the version of this program.
|
||||
EOF
|
||||
exit(1);
|
||||
}
|
||||
BIN
codes/agent/dbbackup/mysql/mysql_embedded.exe
Normal file
BIN
codes/agent/dbbackup/mysql/mysql_embedded.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/mysql_install_db.exe
Normal file
BIN
codes/agent/dbbackup/mysql/mysql_install_db.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/mysql_plugin.exe
Normal file
BIN
codes/agent/dbbackup/mysql/mysql_plugin.exe
Normal file
Binary file not shown.
393
codes/agent/dbbackup/mysql/mysql_secure_installation.pl
Normal file
393
codes/agent/dbbackup/mysql/mysql_secure_installation.pl
Normal file
@@ -0,0 +1,393 @@
|
||||
#!/usr/bin/perl
|
||||
# -*- cperl -*-
|
||||
#
|
||||
# Copyright (c) 2007, 2012, Oracle and/or its affiliates.
|
||||
#
|
||||
# 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
|
||||
|
||||
use Fcntl;
|
||||
use File::Spec;
|
||||
use if $^O eq 'MSWin32', 'Term::ReadKey' => qw/ReadMode/;
|
||||
use strict;
|
||||
|
||||
my $config = ".my.cnf.$$";
|
||||
my $command = ".mysql.$$";
|
||||
my $hadpass = 0;
|
||||
my $mysql; # How to call the mysql client
|
||||
my $rootpass = "";
|
||||
|
||||
|
||||
$SIG{QUIT} = $SIG{INT} = $SIG{TERM} = $SIG{ABRT} = $SIG{HUP} = sub {
|
||||
print "\nAborting!\n\n";
|
||||
echo_on();
|
||||
cleanup();
|
||||
exit 1;
|
||||
};
|
||||
|
||||
|
||||
END {
|
||||
# Remove temporary files, even if exiting via die(), etc.
|
||||
cleanup();
|
||||
}
|
||||
|
||||
|
||||
sub read_without_echo {
|
||||
my ($prompt) = @_;
|
||||
print $prompt;
|
||||
echo_off();
|
||||
my $answer = <STDIN>;
|
||||
echo_on();
|
||||
print "\n";
|
||||
chomp($answer);
|
||||
return $answer;
|
||||
}
|
||||
|
||||
sub echo_on {
|
||||
if ($^O eq 'MSWin32') {
|
||||
ReadMode('normal');
|
||||
} else {
|
||||
system("stty echo");
|
||||
}
|
||||
}
|
||||
|
||||
sub echo_off {
|
||||
if ($^O eq 'MSWin32') {
|
||||
ReadMode('noecho');
|
||||
} else {
|
||||
system("stty -echo");
|
||||
}
|
||||
}
|
||||
|
||||
sub write_file {
|
||||
my $file = shift;
|
||||
-f $file or die "ERROR: file is missing \"$file\": $!";
|
||||
open(FILE, ">$file") or die "ERROR: can't write to file \"$file\": $!";
|
||||
foreach my $line ( @_ ) {
|
||||
print FILE $line, "\n"; # Add EOL char
|
||||
}
|
||||
close FILE;
|
||||
}
|
||||
|
||||
sub prepare {
|
||||
# Locate the mysql client; look in current directory first, then
|
||||
# in path
|
||||
our $SAVEERR; # Suppress Perl warning message
|
||||
open SAVEERR, ">& STDERR";
|
||||
close STDERR;
|
||||
for my $m (File::Spec->catfile('bin', 'mysql'), 'mysql') {
|
||||
# mysql --version should always work
|
||||
qx($m --no-defaults --version);
|
||||
next unless $? == 0;
|
||||
|
||||
$mysql = $m;
|
||||
last;
|
||||
}
|
||||
open STDERR, ">& SAVEERR";
|
||||
|
||||
die "Can't find a 'mysql' client in PATH or ./bin\n"
|
||||
unless $mysql;
|
||||
|
||||
# Create safe files to avoid leaking info to other users
|
||||
foreach my $file ( $config, $command ) {
|
||||
next if -f $file; # Already exists
|
||||
local *FILE;
|
||||
sysopen(FILE, $file, O_CREAT, 0600)
|
||||
or die "ERROR: can't create $file: $!";
|
||||
close FILE;
|
||||
}
|
||||
}
|
||||
|
||||
# Simple escape mechanism (\-escape any ' and \), suitable for two contexts:
|
||||
# - single-quoted SQL strings
|
||||
# - single-quoted option values on the right hand side of = in my.cnf
|
||||
#
|
||||
# These two contexts don't handle escapes identically. SQL strings allow
|
||||
# quoting any character (\C => C, for any C), but my.cnf parsing allows
|
||||
# quoting only \, ' or ". For example, password='a\b' quotes a 3-character
|
||||
# string in my.cnf, but a 2-character string in SQL.
|
||||
#
|
||||
# This simple escape works correctly in both places.
|
||||
sub basic_single_escape {
|
||||
my ($str) = @_;
|
||||
# Inside a character class, \ is not special; this escapes both \ and '
|
||||
$str =~ s/([\'])/\\$1/g;
|
||||
return $str;
|
||||
}
|
||||
|
||||
sub do_query {
|
||||
my $query = shift;
|
||||
write_file($command, $query);
|
||||
my $rv = system("$mysql --defaults-file=$config < $command");
|
||||
# system() returns -1 if exec fails (e.g., command not found, etc.); die
|
||||
# in this case because nothing is going to work
|
||||
die "Failed to execute mysql client '$mysql'\n" if $rv == -1;
|
||||
# Return true if query executed OK, or false if there was some problem
|
||||
# (for example, SQL error or wrong password)
|
||||
return ($rv == 0 ? 1 : undef);
|
||||
}
|
||||
|
||||
sub make_config {
|
||||
my $password = shift;
|
||||
|
||||
my $esc_pass = basic_single_escape($rootpass);
|
||||
write_file($config,
|
||||
"# mysql_secure_installation config file",
|
||||
"[mysql]",
|
||||
"user=root",
|
||||
"password='$esc_pass'");
|
||||
}
|
||||
|
||||
sub get_root_password {
|
||||
my $attempts = 3;
|
||||
for (;;) {
|
||||
my $password = read_without_echo("Enter current password for root (enter for none): ");
|
||||
if ( $password ) {
|
||||
$hadpass = 1;
|
||||
} else {
|
||||
$hadpass = 0;
|
||||
}
|
||||
$rootpass = $password;
|
||||
make_config($rootpass);
|
||||
last if do_query("");
|
||||
|
||||
die "Unable to connect to the server as root user, giving up.\n"
|
||||
if --$attempts == 0;
|
||||
}
|
||||
print "OK, successfully used password, moving on...\n\n";
|
||||
}
|
||||
|
||||
sub set_root_password {
|
||||
my $password1;
|
||||
for (;;) {
|
||||
$password1 = read_without_echo("New password: ");
|
||||
|
||||
if ( !$password1 ) {
|
||||
print "Sorry, you can't use an empty password here.\n\n";
|
||||
next;
|
||||
}
|
||||
|
||||
my $password2 = read_without_echo("Re-enter new password: ");
|
||||
|
||||
if ( $password1 ne $password2 ) {
|
||||
print "Sorry, passwords do not match.\n\n";
|
||||
next;
|
||||
}
|
||||
|
||||
last;
|
||||
}
|
||||
|
||||
my $esc_pass = basic_single_escape($password1);
|
||||
do_query("UPDATE mysql.user SET Password=PASSWORD('$esc_pass') WHERE User='root';")
|
||||
or die "Password update failed!\n";
|
||||
|
||||
print "Password updated successfully!\n";
|
||||
print "Reloading privilege tables..\n";
|
||||
reload_privilege_tables()
|
||||
or die "Can not continue.\n";
|
||||
|
||||
print "\n";
|
||||
$rootpass = $password1;
|
||||
make_config($rootpass);
|
||||
}
|
||||
|
||||
sub remove_anonymous_users {
|
||||
do_query("DELETE FROM mysql.user WHERE User='';")
|
||||
or die print " ... Failed!\n";
|
||||
print " ... Success!\n";
|
||||
}
|
||||
|
||||
sub remove_remote_root {
|
||||
if (do_query("DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');")) {
|
||||
print " ... Success!\n";
|
||||
} else {
|
||||
print " ... Failed!\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub remove_test_database {
|
||||
print " - Dropping test database...\n";
|
||||
if (do_query("DROP DATABASE test;")) {
|
||||
print " ... Success!\n";
|
||||
} else {
|
||||
print " ... Failed! Not critical, keep moving...\n";
|
||||
}
|
||||
|
||||
print " - Removing privileges on test database...\n";
|
||||
if (do_query("DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'")) {
|
||||
print " ... Success!\n";
|
||||
} else {
|
||||
print " ... Failed! Not critical, keep moving...\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub reload_privilege_tables {
|
||||
if (do_query("FLUSH PRIVILEGES;")) {
|
||||
print " ... Success!\n";
|
||||
return 1;
|
||||
} else {
|
||||
print " ... Failed!\n";
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
|
||||
sub cleanup {
|
||||
print "Cleaning up...\n";
|
||||
|
||||
foreach my $file ($config, $command) {
|
||||
unlink $file or warn "Warning: Could not unlink $file: $!\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# The actual script starts here
|
||||
|
||||
prepare();
|
||||
|
||||
print <<HERE;
|
||||
|
||||
|
||||
|
||||
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
|
||||
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
|
||||
|
||||
In order to log into MySQL to secure it, we'll need the current
|
||||
password for the root user. If you've just installed MySQL, and
|
||||
you haven't set the root password yet, the password will be blank,
|
||||
so you should just press enter here.
|
||||
|
||||
HERE
|
||||
|
||||
get_root_password();
|
||||
|
||||
|
||||
#
|
||||
# Set the root password
|
||||
#
|
||||
|
||||
print "Setting the root password ensures that nobody can log into the MySQL\n";
|
||||
print "root user without the proper authorisation.\n\n";
|
||||
|
||||
if ( $hadpass == 0 ) {
|
||||
print "Set root password? [Y/n] ";
|
||||
} else {
|
||||
print "You already have a root password set, so you can safely answer 'n'.\n\n";
|
||||
print "Change the root password? [Y/n] ";
|
||||
}
|
||||
|
||||
my $reply = <STDIN>;
|
||||
if ( $reply =~ /n/i ) {
|
||||
print " ... skipping.\n";
|
||||
} else {
|
||||
set_root_password();
|
||||
}
|
||||
print "\n";
|
||||
|
||||
|
||||
#
|
||||
# Remove anonymous users
|
||||
#
|
||||
|
||||
print <<HERE;
|
||||
By default, a MySQL installation has an anonymous user, allowing anyone
|
||||
to log into MySQL without having to have a user account created for
|
||||
them. This is intended only for testing, and to make the installation
|
||||
go a bit smoother. You should remove them before moving into a
|
||||
production environment.
|
||||
|
||||
HERE
|
||||
|
||||
print "Remove anonymous users? [Y/n] ";
|
||||
$reply = <STDIN>;
|
||||
if ( $reply =~ /n/i ) {
|
||||
print " ... skipping.\n";
|
||||
} else {
|
||||
remove_anonymous_users();
|
||||
}
|
||||
print "\n";
|
||||
|
||||
|
||||
#
|
||||
# Disallow remote root login
|
||||
#
|
||||
|
||||
print <<HERE;
|
||||
Normally, root should only be allowed to connect from 'localhost'. This
|
||||
ensures that someone cannot guess at the root password from the network.
|
||||
|
||||
HERE
|
||||
|
||||
print "Disallow root login remotely? [Y/n] ";
|
||||
$reply = <STDIN>;
|
||||
if ( $reply =~ /n/i ) {
|
||||
print " ... skipping.\n";
|
||||
} else {
|
||||
remove_remote_root();
|
||||
}
|
||||
print "\n";
|
||||
|
||||
|
||||
#
|
||||
# Remove test database
|
||||
#
|
||||
|
||||
print <<HERE;
|
||||
By default, MySQL comes with a database named 'test' that anyone can
|
||||
access. This is also intended only for testing, and should be removed
|
||||
before moving into a production environment.
|
||||
|
||||
HERE
|
||||
|
||||
print "Remove test database and access to it? [Y/n] ";
|
||||
$reply = <STDIN>;
|
||||
if ( $reply =~ /n/i ) {
|
||||
print " ... skipping.\n";
|
||||
} else {
|
||||
remove_test_database();
|
||||
}
|
||||
print "\n";
|
||||
|
||||
|
||||
#
|
||||
# Reload privilege tables
|
||||
#
|
||||
|
||||
print <<HERE;
|
||||
Reloading the privilege tables will ensure that all changes made so far
|
||||
will take effect immediately.
|
||||
|
||||
HERE
|
||||
|
||||
print "Reload privilege tables now? [Y/n] ";
|
||||
$reply = <STDIN>;
|
||||
if ( $reply =~ /n/i ) {
|
||||
print " ... skipping.\n";
|
||||
} else {
|
||||
reload_privilege_tables();
|
||||
}
|
||||
print "\n";
|
||||
|
||||
print <<HERE;
|
||||
|
||||
|
||||
|
||||
All done! If you've completed all of the above steps, your MySQL
|
||||
installation should now be secure.
|
||||
|
||||
Thanks for using MySQL!
|
||||
|
||||
|
||||
HERE
|
||||
|
||||
|
||||
|
||||
BIN
codes/agent/dbbackup/mysql/mysql_tzinfo_to_sql.exe
Normal file
BIN
codes/agent/dbbackup/mysql/mysql_tzinfo_to_sql.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/mysql_upgrade.exe
Normal file
BIN
codes/agent/dbbackup/mysql/mysql_upgrade.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/mysql_upgrade_service.exe
Normal file
BIN
codes/agent/dbbackup/mysql/mysql_upgrade_service.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/mysql_upgrade_wizard.exe
Normal file
BIN
codes/agent/dbbackup/mysql/mysql_upgrade_wizard.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/mysqladmin.exe
Normal file
BIN
codes/agent/dbbackup/mysql/mysqladmin.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/mysqlbinlog.exe
Normal file
BIN
codes/agent/dbbackup/mysql/mysqlbinlog.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/mysqlcheck.exe
Normal file
BIN
codes/agent/dbbackup/mysql/mysqlcheck.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/mysqld.exe
Normal file
BIN
codes/agent/dbbackup/mysql/mysqld.exe
Normal file
Binary file not shown.
853
codes/agent/dbbackup/mysql/mysqld_multi.pl
Normal file
853
codes/agent/dbbackup/mysql/mysqld_multi.pl
Normal file
@@ -0,0 +1,853 @@
|
||||
#!/usr/bin/perl
|
||||
# Copyright (c) 2000, 2010, Oracle and/or its affiliates.
|
||||
# Copyright (c) 2000-2011 Monty Program Ab, Jani Tolonen
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library 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
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
|
||||
# MA 02110-1301, USA
|
||||
|
||||
# Copyright (c) 2000, 2010, 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 Library 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
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
|
||||
# MA 02110-1301, USA
|
||||
|
||||
use Getopt::Long;
|
||||
use POSIX qw(strftime getcwd);
|
||||
|
||||
$|=1;
|
||||
$VER="2.20";
|
||||
|
||||
my @defaults_options; # Leading --no-defaults, --defaults-file, etc.
|
||||
|
||||
$opt_example = 0;
|
||||
$opt_help = 0;
|
||||
$opt_log = undef();
|
||||
$opt_mysqladmin = "C:/Program Files (x86)/MySQL/bin/mysqladmin";
|
||||
$opt_mysqld = "C:/Program Files (x86)/MySQL/bin/mysqld";
|
||||
$opt_no_log = 0;
|
||||
$opt_password = undef();
|
||||
$opt_tcp_ip = 0;
|
||||
$opt_user = "root";
|
||||
$opt_version = 0;
|
||||
$opt_silent = 0;
|
||||
$opt_verbose = 0;
|
||||
|
||||
my $my_print_defaults_exists= 1;
|
||||
my $logdir= undef();
|
||||
|
||||
my ($mysqld, $mysqladmin, $groupids, $homedir, $my_progname);
|
||||
|
||||
$homedir = $ENV{HOME};
|
||||
$my_progname = $0;
|
||||
$my_progname =~ s/.*[\/]//;
|
||||
|
||||
|
||||
if (defined($ENV{UMASK})) {
|
||||
my $UMASK = $ENV{UMASK};
|
||||
my $m;
|
||||
my $fmode = "0640";
|
||||
|
||||
if(($UMASK =~ m/[^0246]/) || ($UMASK =~ m/^[^0]/) || (length($UMASK) != 4)) {
|
||||
printf("UMASK must be a 3-digit mode with an additional leading 0 to indicate octal.\n");
|
||||
printf("The first digit will be corrected to 6, the others may be 0, 2, 4, or 6.\n"); }
|
||||
else {
|
||||
$fmode= substr $UMASK, 2, 2;
|
||||
$fmode= "06${fmode}"; }
|
||||
|
||||
if($fmode != $UMASK) {
|
||||
printf("UMASK corrected from $UMASK to $fmode ...\n"); }
|
||||
|
||||
$fmode= oct($fmode);
|
||||
|
||||
umask($fmode);
|
||||
}
|
||||
|
||||
|
||||
main();
|
||||
|
||||
####
|
||||
#### main sub routine
|
||||
####
|
||||
|
||||
sub main
|
||||
{
|
||||
my $flag_exit= 0;
|
||||
|
||||
if (!defined(my_which(my_print_defaults)))
|
||||
{
|
||||
# We can't throw out yet, since --version, --help, or --example may
|
||||
# have been given
|
||||
print "WARNING: my_print_defaults command not found.\n";
|
||||
print "Please make sure you have this command available and\n";
|
||||
print "in your path. The command is available from the latest\n";
|
||||
print "MariaDB distribution.\n";
|
||||
$my_print_defaults_exists= 0;
|
||||
}
|
||||
|
||||
# Remove leading defaults options from @ARGV
|
||||
while (@ARGV > 0)
|
||||
{
|
||||
last unless $ARGV[0] =~
|
||||
/^--(?:no-defaults$|(?:defaults-file|defaults-extra-file)=)/;
|
||||
push @defaults_options, (shift @ARGV);
|
||||
}
|
||||
|
||||
foreach (@defaults_options)
|
||||
{
|
||||
$_ = quote_shell_word($_);
|
||||
}
|
||||
|
||||
# Add [mysqld_multi] options to front of @ARGV, ready for GetOptions()
|
||||
unshift @ARGV, defaults_for_group('mysqld_multi');
|
||||
|
||||
# We've already handled --no-defaults, --defaults-file, etc.
|
||||
if (!GetOptions("help", "example", "version", "mysqld=s", "mysqladmin=s",
|
||||
"user=s", "password=s", "log=s", "no-log",
|
||||
"tcp-ip", "silent", "verbose"))
|
||||
{
|
||||
$flag_exit= 1;
|
||||
}
|
||||
usage() if ($opt_help);
|
||||
|
||||
if ($opt_verbose && $opt_silent)
|
||||
{
|
||||
print "Both --verbose and --silent have been given. Some of the warnings ";
|
||||
print "will be disabled\nand some will be enabled.\n\n";
|
||||
}
|
||||
|
||||
init_log() if (!defined($opt_log));
|
||||
$groupids = $ARGV[1];
|
||||
if ($opt_version)
|
||||
{
|
||||
print "$my_progname version $VER by Jani Tolonen\n";
|
||||
exit(0);
|
||||
}
|
||||
example() if ($opt_example);
|
||||
if ($flag_exit)
|
||||
{
|
||||
print "Error with an option, see $my_progname --help for more info.\n";
|
||||
exit(1);
|
||||
}
|
||||
if (!defined(my_which(my_print_defaults)))
|
||||
{
|
||||
print "ABORT: Can't find command 'my_print_defaults'.\n";
|
||||
print "This command is available from the latest MariaDB\n";
|
||||
print "distribution. Please make sure you have the command\n";
|
||||
print "in your PATH.\n";
|
||||
exit(1);
|
||||
}
|
||||
usage() if (!defined($ARGV[0]) ||
|
||||
(!($ARGV[0] =~ m/^start$/i) &&
|
||||
!($ARGV[0] =~ m/^stop$/i) &&
|
||||
!($ARGV[0] =~ m/^report$/i)));
|
||||
|
||||
if (!$opt_no_log)
|
||||
{
|
||||
w2log("$my_progname log file version $VER; run: ",
|
||||
"$opt_log", 1, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "$my_progname log file version $VER; run: ";
|
||||
print strftime "%a %b %e %H:%M:%S %Y", localtime;
|
||||
print "\n";
|
||||
}
|
||||
if ($ARGV[0] =~ m/^start$/i)
|
||||
{
|
||||
if (!defined(($mysqld= my_which($opt_mysqld))) && $opt_verbose)
|
||||
{
|
||||
print "WARNING: Couldn't find the default mysqld binary.\n";
|
||||
print "Tried: $opt_mysqld\n";
|
||||
print "This is OK, if you are using option \"mysqld=...\" in ";
|
||||
print "groups [mysqldN] separately for each.\n\n";
|
||||
}
|
||||
start_mysqlds();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!defined(($mysqladmin= my_which($opt_mysqladmin))) && $opt_verbose)
|
||||
{
|
||||
print "WARNING: Couldn't find the default mysqladmin binary.\n";
|
||||
print "Tried: $opt_mysqladmin\n";
|
||||
print "This is OK, if you are using option \"mysqladmin=...\" in ";
|
||||
print "groups [mysqldN] separately for each.\n\n";
|
||||
}
|
||||
if ($ARGV[0] =~ m/^report$/i)
|
||||
{
|
||||
report_mysqlds();
|
||||
}
|
||||
else
|
||||
{
|
||||
stop_mysqlds();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#
|
||||
# Quote word for shell
|
||||
#
|
||||
|
||||
sub quote_shell_word
|
||||
{
|
||||
my ($option)= @_;
|
||||
|
||||
$option =~ s!([^\w=./-])!\\$1!g;
|
||||
return $option;
|
||||
}
|
||||
|
||||
####
|
||||
#### get options for a group
|
||||
####
|
||||
|
||||
sub defaults_for_group
|
||||
{
|
||||
my ($group) = @_;
|
||||
|
||||
return () unless $my_print_defaults_exists;
|
||||
|
||||
my $com= join ' ', 'my_print_defaults', @defaults_options, $group;
|
||||
my @defaults = `$com`;
|
||||
chomp @defaults;
|
||||
return @defaults;
|
||||
}
|
||||
|
||||
####
|
||||
#### Init log file. Check for appropriate place for log file, in the following
|
||||
#### order: my_print_defaults mysqld datadir, C:/Program Files (x86)/MySQL/share
|
||||
####
|
||||
|
||||
sub init_log
|
||||
{
|
||||
foreach my $opt (defaults_for_group('--mysqld'))
|
||||
{
|
||||
if ($opt =~ m/^--datadir=(.*)/ && -d "$1" && -w "$1")
|
||||
{
|
||||
$logdir= $1;
|
||||
}
|
||||
}
|
||||
if (!defined($logdir))
|
||||
{
|
||||
$logdir= "C:/Program Files (x86)/MySQL/share" if (-d "C:/Program Files (x86)/MySQL/share" && -w "C:/Program Files (x86)/MySQL/share");
|
||||
}
|
||||
if (!defined($logdir))
|
||||
{
|
||||
# Log file was not specified and we could not log to a standard place,
|
||||
# so log file be disabled for now.
|
||||
if (!$opt_silent)
|
||||
{
|
||||
print "WARNING: Log file disabled. Maybe directory or file isn't writable?\n";
|
||||
}
|
||||
$opt_no_log= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$opt_log= "$logdir/mysqld_multi.log";
|
||||
}
|
||||
}
|
||||
|
||||
####
|
||||
#### Report living and not running MariaDB servers
|
||||
####
|
||||
|
||||
sub report_mysqlds
|
||||
{
|
||||
my (@groups, $com, $i, @options, $pec);
|
||||
|
||||
print "Reporting MariaDB servers\n";
|
||||
if (!$opt_no_log)
|
||||
{
|
||||
w2log("\nReporting MariaDB servers","$opt_log",0,0);
|
||||
}
|
||||
@groups = &find_groups($groupids);
|
||||
for ($i = 0; defined($groups[$i]); $i++)
|
||||
{
|
||||
$com= get_mysqladmin_options($i, @groups);
|
||||
$com.= " ping >> /dev/null 2>&1";
|
||||
system($com);
|
||||
$pec = $? >> 8;
|
||||
if ($pec)
|
||||
{
|
||||
print "MariaDB server from group: $groups[$i] is not running\n";
|
||||
if (!$opt_no_log)
|
||||
{
|
||||
w2log("MariaDB server from group: $groups[$i] is not running",
|
||||
"$opt_log", 0, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print "MariaDB server from group: $groups[$i] is running\n";
|
||||
if (!$opt_no_log)
|
||||
{
|
||||
w2log("MariaDB server from group: $groups[$i] is running",
|
||||
"$opt_log", 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$i)
|
||||
{
|
||||
print "No groups to be reported (check your GNRs)\n";
|
||||
if (!$opt_no_log)
|
||||
{
|
||||
w2log("No groups to be reported (check your GNRs)", "$opt_log", 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
####
|
||||
#### start multiple servers
|
||||
####
|
||||
|
||||
sub start_mysqlds()
|
||||
{
|
||||
my (@groups, $com, $tmp, $i, @options, $j, $mysqld_found, $info_sent);
|
||||
|
||||
if (!$opt_no_log)
|
||||
{
|
||||
w2log("\nStarting MariaDB servers\n","$opt_log",0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "\nStarting MariaDB servers\n";
|
||||
}
|
||||
@groups = &find_groups($groupids);
|
||||
for ($i = 0; defined($groups[$i]); $i++)
|
||||
{
|
||||
@options = defaults_for_group($groups[$i]);
|
||||
|
||||
$basedir_found= 0; # The default
|
||||
$mysqld_found= 1; # The default
|
||||
$mysqld_found= 0 if (!length($mysqld));
|
||||
$com= "$mysqld";
|
||||
for ($j = 0, $tmp= ""; defined($options[$j]); $j++)
|
||||
{
|
||||
if ("--mysqladmin=" eq substr($options[$j], 0, 13))
|
||||
{
|
||||
# catch this and ignore
|
||||
}
|
||||
elsif ("--mysqld=" eq substr($options[$j], 0, 9))
|
||||
{
|
||||
$options[$j]=~ s/\-\-mysqld\=//;
|
||||
$com= $options[$j];
|
||||
$mysqld_found= 1;
|
||||
}
|
||||
elsif ("--basedir=" eq substr($options[$j], 0, 10))
|
||||
{
|
||||
$basedir= $options[$j];
|
||||
$basedir =~ s/^--basedir=//;
|
||||
$basedir_found= 1;
|
||||
$options[$j]= quote_shell_word($options[$j]);
|
||||
$tmp.= " $options[$j]";
|
||||
}
|
||||
else
|
||||
{
|
||||
$options[$j]= quote_shell_word($options[$j]);
|
||||
$tmp.= " $options[$j]";
|
||||
}
|
||||
}
|
||||
if ($opt_verbose && $com =~ m/\/(safe_mysqld|mysqld_safe)$/ && !$info_sent)
|
||||
{
|
||||
print "WARNING: $1 is being used to start mysqld. In this case you ";
|
||||
print "may need to pass\n\"ledir=...\" under groups [mysqldN] to ";
|
||||
print "$1 in order to find the actual mysqld binary.\n";
|
||||
print "ledir (library executable directory) should be the path to the ";
|
||||
print "wanted mysqld binary.\n\n";
|
||||
$info_sent= 1;
|
||||
}
|
||||
$com.= $tmp;
|
||||
$com.= " >> $opt_log 2>&1" if (!$opt_no_log);
|
||||
$com.= " &";
|
||||
if (!$mysqld_found)
|
||||
{
|
||||
print "\n";
|
||||
print "FATAL ERROR: Tried to start mysqld under group [$groups[$i]], ";
|
||||
print "but no mysqld binary was found.\n";
|
||||
print "Please add \"mysqld=...\" in group [mysqld_multi], or add it to ";
|
||||
print "group [$groups[$i]] separately.\n";
|
||||
exit(1);
|
||||
}
|
||||
if ($basedir_found)
|
||||
{
|
||||
$curdir=getcwd();
|
||||
chdir($basedir) or die "Can't change to datadir $basedir";
|
||||
}
|
||||
system($com);
|
||||
if ($basedir_found)
|
||||
{
|
||||
chdir($curdir) or die "Can't change back to original dir $curdir";
|
||||
}
|
||||
}
|
||||
if (!$i && !$opt_no_log)
|
||||
{
|
||||
w2log("No MariaDB servers to be started (check your GNRs)",
|
||||
"$opt_log", 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
####
|
||||
#### stop multiple servers
|
||||
####
|
||||
|
||||
sub stop_mysqlds()
|
||||
{
|
||||
my (@groups, $com, $i, @options);
|
||||
|
||||
if (!$opt_no_log)
|
||||
{
|
||||
w2log("\nStopping MariaDB servers\n","$opt_log",0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
print "\nStopping MariaDB servers\n";
|
||||
}
|
||||
@groups = &find_groups($groupids);
|
||||
for ($i = 0; defined($groups[$i]); $i++)
|
||||
{
|
||||
$com= get_mysqladmin_options($i, @groups);
|
||||
$com.= " shutdown";
|
||||
$com.= " >> $opt_log 2>&1" if (!$opt_no_log);
|
||||
$com.= " &";
|
||||
system($com);
|
||||
}
|
||||
if (!$i && !$opt_no_log)
|
||||
{
|
||||
w2log("No MariaDB servers to be stopped (check your GNRs)",
|
||||
"$opt_log", 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
####
|
||||
#### Sub function for mysqladmin option parsing
|
||||
####
|
||||
|
||||
sub get_mysqladmin_options
|
||||
{
|
||||
my ($i, @groups)= @_;
|
||||
my ($mysqladmin_found, $com, $tmp, $j);
|
||||
|
||||
@options = defaults_for_group($groups[$i]);
|
||||
|
||||
$mysqladmin_found= 1; # The default
|
||||
$mysqladmin_found= 0 if (!length($mysqladmin));
|
||||
$com = "$mysqladmin";
|
||||
$tmp = " -u $opt_user";
|
||||
if (defined($opt_password)) {
|
||||
my $pw= $opt_password;
|
||||
# Protect single quotes in password
|
||||
$pw =~ s/'/'"'"'/g;
|
||||
$tmp.= " -p'$pw'";
|
||||
}
|
||||
$tmp.= $opt_tcp_ip ? " -h 127.0.0.1" : "";
|
||||
for ($j = 0; defined($options[$j]); $j++)
|
||||
{
|
||||
if ("--mysqladmin=" eq substr($options[$j], 0, 13))
|
||||
{
|
||||
$options[$j]=~ s/\-\-mysqladmin\=//;
|
||||
$com= $options[$j];
|
||||
$mysqladmin_found= 1;
|
||||
}
|
||||
elsif ((($options[$j] =~ m/^(\-\-socket\=)(.*)$/) && !$opt_tcp_ip) ||
|
||||
($options[$j] =~ m/^(\-\-port\=)(.*)$/))
|
||||
{
|
||||
$tmp.= " $options[$j]";
|
||||
}
|
||||
}
|
||||
if (!$mysqladmin_found)
|
||||
{
|
||||
print "\n";
|
||||
print "FATAL ERROR: Tried to use mysqladmin in group [$groups[$i]], ";
|
||||
print "but no mysqladmin binary was found.\n";
|
||||
print "Please add \"mysqladmin=...\" in group [mysqld_multi], or ";
|
||||
print "in group [$groups[$i]].\n";
|
||||
exit(1);
|
||||
}
|
||||
$com.= $tmp;
|
||||
return $com;
|
||||
}
|
||||
|
||||
# Return a list of option files which can be opened. Similar, but not
|
||||
# identical, to behavior of my_search_option_files()
|
||||
# TODO implement and use my_print_defaults --list-groups instead
|
||||
sub list_defaults_files
|
||||
{
|
||||
my %opt;
|
||||
foreach (@defaults_options)
|
||||
{
|
||||
return () if /^--no-defaults$/;
|
||||
$opt{$1} = $2 if /^--defaults-(extra-file|file)=(.*)$/;
|
||||
}
|
||||
|
||||
return ($opt{file}) if exists $opt{file};
|
||||
|
||||
return ('/etc/my.cnf',
|
||||
'/etc/mysql/my.cnf',
|
||||
'C:/Program Files (x86)/MySQL/my.cnf',
|
||||
($ENV{MYSQL_HOME} ? "$ENV{MYSQL_HOME}/my.cnf" : undef),
|
||||
$opt{'extra-file'},
|
||||
($ENV{HOME} ? "$ENV{HOME}/.my.cnf" : undef));
|
||||
}
|
||||
|
||||
|
||||
# Takes a specification of GNRs (see --help), and returns a list of matching
|
||||
# groups which actually are mentioned in a relevant config file
|
||||
sub find_groups
|
||||
{
|
||||
my ($raw_gids) = @_;
|
||||
|
||||
my %gids;
|
||||
my @groups;
|
||||
|
||||
if (defined($raw_gids))
|
||||
{
|
||||
# Make a hash of the wanted group ids
|
||||
foreach my $raw_gid (split ',', $raw_gids)
|
||||
{
|
||||
# Match 123 or 123-456
|
||||
my ($start, $end) = ($raw_gid =~ /^\s*(\d+)(?:\s*-\s*(\d+))?\s*$/);
|
||||
$end = $start if not defined $end;
|
||||
if (not defined $start or $end < $start or $start < 0)
|
||||
{
|
||||
print "ABORT: Bad GNR: $raw_gid; see $my_progname --help\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
foreach my $i ($start .. $end)
|
||||
{
|
||||
# Use $i + 0 to normalize numbers (002 + 0 -> 2)
|
||||
$gids{$i + 0}= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my %seen;
|
||||
my @defaults_files = list_defaults_files();
|
||||
while (@defaults_files)
|
||||
{
|
||||
my $file = shift @defaults_files;
|
||||
next unless defined $file and not $seen{$file}++ and open CONF, '<', $file;
|
||||
|
||||
while (<CONF>)
|
||||
{
|
||||
if (/^\s*\[\s*(mysqld)(\d+)\s*\]\s*$/)
|
||||
{
|
||||
#warn "Found a group: $1$2\n";
|
||||
# Use $2 + 0 to normalize numbers (002 + 0 -> 2)
|
||||
if (not defined($raw_gids) or $gids{$2 + 0})
|
||||
{
|
||||
push @groups, "$1$2";
|
||||
}
|
||||
}
|
||||
elsif (/^\s*!include\s+(\S.*?)\s*$/)
|
||||
{
|
||||
push @defaults_files, $1;
|
||||
}
|
||||
elsif (/^\s*!includedir\s+(\S.*?)\s*$/)
|
||||
{
|
||||
push @defaults_files, <$1/*.cnf>;
|
||||
}
|
||||
}
|
||||
|
||||
close CONF;
|
||||
}
|
||||
return @groups;
|
||||
}
|
||||
|
||||
####
|
||||
#### w2log: Write to a logfile.
|
||||
#### 1.arg: append to the log file (given string, or from a file. if a file,
|
||||
#### file will be read from $opt_logdir)
|
||||
#### 2.arg: logfile -name (w2log assumes that the logfile is in $opt_logdir).
|
||||
#### 3.arg. 0 | 1, if true, print current date to the logfile. 3. arg will
|
||||
#### be ignored, if 1. arg is a file.
|
||||
#### 4.arg. 0 | 1, if true, first argument is a file, else a string
|
||||
####
|
||||
|
||||
sub w2log
|
||||
{
|
||||
my ($msg, $file, $date_flag, $is_file)= @_;
|
||||
my (@data);
|
||||
|
||||
open (LOGFILE, ">>$opt_log")
|
||||
or die "FATAL: w2log: Couldn't open log file: $opt_log\n";
|
||||
|
||||
if ($is_file)
|
||||
{
|
||||
open (FROMFILE, "<$msg") && (@data=<FROMFILE>) &&
|
||||
close(FROMFILE)
|
||||
or die "FATAL: w2log: Couldn't open file: $msg\n";
|
||||
foreach my $line (@data)
|
||||
{
|
||||
print LOGFILE "$line";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print LOGFILE "$msg";
|
||||
print LOGFILE strftime "%a %b %e %H:%M:%S %Y", localtime if ($date_flag);
|
||||
print LOGFILE "\n";
|
||||
}
|
||||
close (LOGFILE);
|
||||
return;
|
||||
}
|
||||
|
||||
####
|
||||
#### my_which is used, because we can't assume that every system has the
|
||||
#### which -command. my_which can take only one argument at a time.
|
||||
#### Return values: requested system command with the first found path,
|
||||
#### or undefined, if not found.
|
||||
####
|
||||
|
||||
sub my_which
|
||||
{
|
||||
my ($command) = @_;
|
||||
my (@paths, $path);
|
||||
|
||||
return $command if (-f $command && -x $command);
|
||||
@paths = split(':', $ENV{'PATH'});
|
||||
foreach $path (@paths)
|
||||
{
|
||||
$path .= "/$command";
|
||||
return $path if (-f $path && -x $path);
|
||||
}
|
||||
return undef();
|
||||
}
|
||||
|
||||
|
||||
####
|
||||
#### example
|
||||
####
|
||||
|
||||
sub example
|
||||
{
|
||||
print <<EOF;
|
||||
# This is an example of a my.cnf file for $my_progname.
|
||||
# Usually this file is located in home dir ~/.my.cnf or /etc/my.cnf
|
||||
#
|
||||
# SOME IMPORTANT NOTES FOLLOW:
|
||||
#
|
||||
# 1.COMMON USER
|
||||
#
|
||||
# Make sure that the MariaDB user, who is stopping the mysqld services, has
|
||||
# the same password to all MariaDB servers being accessed by $my_progname.
|
||||
# This user needs to have the 'Shutdown_priv' -privilege, but for security
|
||||
# reasons should have no other privileges. It is advised that you create a
|
||||
# common 'multi_admin' user for all MariaDB servers being controlled by
|
||||
# $my_progname. Here is an example how to do it:
|
||||
#
|
||||
# GRANT SHUTDOWN ON *.* TO multi_admin\@localhost IDENTIFIED BY 'password'
|
||||
#
|
||||
# You will need to apply the above to all MariaDB servers that are being
|
||||
# controlled by $my_progname. 'multi_admin' will shutdown the servers
|
||||
# using 'mysqladmin' -binary, when '$my_progname stop' is being called.
|
||||
#
|
||||
# 2.PID-FILE
|
||||
#
|
||||
# If you are using mysqld_safe to start mysqld, make sure that every
|
||||
# MariaDB server has a separate pid-file. In order to use mysqld_safe
|
||||
# via $my_progname, you need to use two options:
|
||||
#
|
||||
# mysqld=/path/to/mysqld_safe
|
||||
# ledir=/path/to/mysqld-binary/
|
||||
#
|
||||
# ledir (library executable directory), is an option that only mysqld_safe
|
||||
# accepts, so you will get an error if you try to pass it to mysqld directly.
|
||||
# For this reason you might want to use the above options within [mysqld#]
|
||||
# group directly.
|
||||
#
|
||||
# 3.DATA DIRECTORY
|
||||
#
|
||||
# It is NOT advised to run many MariaDB servers within the same data directory.
|
||||
# You can do so, but please make sure to understand and deal with the
|
||||
# underlying caveats. In short they are:
|
||||
# - Speed penalty
|
||||
# - Risk of table/data corruption
|
||||
# - Data synchronising problems between the running servers
|
||||
# - Heavily media (disk) bound
|
||||
# - Relies on the system (external) file locking
|
||||
# - Is not applicable with all table types. (Such as InnoDB)
|
||||
# Trying so will end up with undesirable results.
|
||||
#
|
||||
# 4.TCP/IP Port
|
||||
#
|
||||
# Every server requires one and it must be unique.
|
||||
#
|
||||
# 5.[mysqld#] Groups
|
||||
#
|
||||
# In the example below the first and the fifth mysqld group was
|
||||
# intentionally left out. You may have 'gaps' in the config file. This
|
||||
# gives you more flexibility.
|
||||
#
|
||||
# 6.MariaDB Server User
|
||||
#
|
||||
# You can pass the user=... option inside [mysqld#] groups. This
|
||||
# can be very handy in some cases, but then you need to run $my_progname
|
||||
# as UNIX root.
|
||||
#
|
||||
# 7.A Start-up Manage Script for $my_progname
|
||||
#
|
||||
# In the recent MariaDB distributions you can find a file called
|
||||
# mysqld_multi.server.sh. It is a wrapper for $my_progname. This can
|
||||
# be used to start and stop multiple servers during boot and shutdown.
|
||||
#
|
||||
# You can place the file in /etc/init.d/mysqld_multi.server.sh and
|
||||
# make the needed symbolic links to it from various run levels
|
||||
# (as per Linux/Unix standard). You may even replace the
|
||||
# /etc/init.d/mysql.server script with it.
|
||||
#
|
||||
# Before using, you must create a my.cnf file either in C:/Program Files (x86)/MySQL/my.cnf
|
||||
# or /root/.my.cnf and add the [mysqld_multi] and [mysqld#] groups.
|
||||
#
|
||||
# The script can be found from support-files/mysqld_multi.server.sh
|
||||
# in MariaDB distribution. (Verify the script before using)
|
||||
#
|
||||
|
||||
[mysqld_multi]
|
||||
mysqld = C:/Program Files (x86)/MySQL/bin/mysqld_safe
|
||||
mysqladmin = C:/Program Files (x86)/MySQL/bin/mysqladmin
|
||||
user = multi_admin
|
||||
password = my_password
|
||||
|
||||
[mysqld2]
|
||||
socket = /tmp/mysql.sock2
|
||||
port = 3307
|
||||
pid-file = C:/MariaDB10.1/data2/hostname.pid2
|
||||
datadir = C:/MariaDB10.1/data2
|
||||
language = C:/Program Files (x86)/MySQL/share/mysql/english
|
||||
user = unix_user1
|
||||
|
||||
[mysqld3]
|
||||
mysqld = /path/to/mysqld_safe
|
||||
ledir = /path/to/mysqld-binary/
|
||||
mysqladmin = /path/to/mysqladmin
|
||||
socket = /tmp/mysql.sock3
|
||||
port = 3308
|
||||
pid-file = C:/MariaDB10.1/data3/hostname.pid3
|
||||
datadir = C:/MariaDB10.1/data3
|
||||
language = C:/Program Files (x86)/MySQL/share/mysql/swedish
|
||||
user = unix_user2
|
||||
|
||||
[mysqld4]
|
||||
socket = /tmp/mysql.sock4
|
||||
port = 3309
|
||||
pid-file = C:/MariaDB10.1/data4/hostname.pid4
|
||||
datadir = C:/MariaDB10.1/data4
|
||||
language = C:/Program Files (x86)/MySQL/share/mysql/estonia
|
||||
user = unix_user3
|
||||
|
||||
[mysqld6]
|
||||
socket = /tmp/mysql.sock6
|
||||
port = 3311
|
||||
pid-file = C:/MariaDB10.1/data6/hostname.pid6
|
||||
datadir = C:/MariaDB10.1/data6
|
||||
language = C:/Program Files (x86)/MySQL/share/mysql/japanese
|
||||
user = unix_user4
|
||||
EOF
|
||||
exit(0);
|
||||
}
|
||||
|
||||
####
|
||||
#### usage
|
||||
####
|
||||
|
||||
sub usage
|
||||
{
|
||||
print <<EOF;
|
||||
$my_progname version $VER by Jani Tolonen
|
||||
|
||||
Description:
|
||||
$my_progname can be used to start, or stop any number of separate
|
||||
mysqld processes running in different TCP/IP ports and UNIX sockets.
|
||||
|
||||
$my_progname can read group [mysqld_multi] from my.cnf file. You may
|
||||
want to put options mysqld=... and mysqladmin=... there. Since
|
||||
version 2.10 these options can also be given under groups [mysqld#],
|
||||
which gives more control over different versions. One can have the
|
||||
default mysqld and mysqladmin under group [mysqld_multi], but this is
|
||||
not mandatory. Please note that if mysqld or mysqladmin is missing
|
||||
from both [mysqld_multi] and [mysqld#], a group that is tried to be
|
||||
used, $my_progname will abort with an error.
|
||||
|
||||
$my_progname will search for groups named [mysqld#] from my.cnf (or
|
||||
the given --defaults-extra-file=...), where '#' can be any positive
|
||||
integer starting from 1. These groups should be the same as the regular
|
||||
[mysqld] group, but with those port, socket and any other options
|
||||
that are to be used with each separate mysqld process. The number
|
||||
in the group name has another function; it can be used for starting,
|
||||
stopping, or reporting any specific mysqld server.
|
||||
|
||||
Usage: $my_progname [OPTIONS] {start|stop|report} [GNR,GNR,GNR...]
|
||||
or $my_progname [OPTIONS] {start|stop|report} [GNR-GNR,GNR,GNR-GNR,...]
|
||||
|
||||
The GNR means the group number. You can start, stop or report any GNR,
|
||||
or several of them at the same time. (See --example) The GNRs list can
|
||||
be comma separated or a dash combined. The latter means that all the
|
||||
GNRs between GNR1-GNR2 will be affected. Without GNR argument all the
|
||||
groups found will either be started, stopped, or reported. Note that
|
||||
syntax for specifying GNRs must appear without spaces.
|
||||
|
||||
Options:
|
||||
|
||||
These options must be given before any others:
|
||||
--no-defaults Do not read any defaults file
|
||||
--defaults-file=... Read only this configuration file, do not read the
|
||||
standard system-wide and user-specific files
|
||||
--defaults-extra-file=... Read this configuration file in addition to the
|
||||
standard system-wide and user-specific files
|
||||
Using: @{[join ' ', @defaults_options]}
|
||||
|
||||
--example Give an example of a config file with extra information.
|
||||
--help Print this help and exit.
|
||||
--log=... Log file. Full path to and the name for the log file. NOTE:
|
||||
If the file exists, everything will be appended.
|
||||
Using: $opt_log
|
||||
--mysqladmin=... mysqladmin binary to be used for a server shutdown.
|
||||
Since version 2.10 this can be given within groups [mysqld#]
|
||||
Using: $mysqladmin
|
||||
--mysqld=... mysqld binary to be used. Note that you can give mysqld_safe
|
||||
to this option also. The options are passed to mysqld. Just
|
||||
make sure you have mysqld in your PATH or fix mysqld_safe.
|
||||
Using: $mysqld
|
||||
Please note: Since mysqld_multi version 2.3 you can also
|
||||
give this option inside groups [mysqld#] in ~/.my.cnf,
|
||||
where '#' stands for an integer (number) of the group in
|
||||
question. This will be recognised as a special option and
|
||||
will not be passed to the mysqld. This will allow one to
|
||||
start different mysqld versions with mysqld_multi.
|
||||
--no-log Print to stdout instead of the log file. By default the log
|
||||
file is turned on.
|
||||
--password=... Password for mysqladmin user.
|
||||
--silent Disable warnings.
|
||||
--tcp-ip Connect to the MariaDB server(s) via the TCP/IP port instead
|
||||
of the UNIX socket. This affects stopping and reporting.
|
||||
If a socket file is missing, the server may still be
|
||||
running, but can be accessed only via the TCP/IP port.
|
||||
By default connecting is done via the UNIX socket.
|
||||
--user=... mysqladmin user. Using: $opt_user
|
||||
--verbose Be more verbose.
|
||||
--version Print the version number and exit.
|
||||
EOF
|
||||
exit(0);
|
||||
}
|
||||
BIN
codes/agent/dbbackup/mysql/mysqldump.exe
Normal file
BIN
codes/agent/dbbackup/mysql/mysqldump.exe
Normal file
Binary file not shown.
234
codes/agent/dbbackup/mysql/mysqldumpslow.pl
Normal file
234
codes/agent/dbbackup/mysql/mysqldumpslow.pl
Normal file
@@ -0,0 +1,234 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# Copyright (c) 2000-2002, 2005-2008 MySQL AB, 2008, 2009 Sun Microsystems, Inc.
|
||||
# Use is subject to license terms.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library 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
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
|
||||
# MA 02110-1301, USA
|
||||
|
||||
# mysqldumpslow - parse and summarize the MySQL slow query log
|
||||
|
||||
# Original version by Tim Bunce, sometime in 2000.
|
||||
# Further changes by Tim Bunce, 8th March 2001.
|
||||
# Handling of strings with \ and double '' by Monty 11 Aug 2001.
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
|
||||
# t=time, l=lock time, r=rows, a=rows affected
|
||||
# at, al, ar and aa are the corresponding averages
|
||||
|
||||
my %opt = (
|
||||
s => 'at',
|
||||
h => '*',
|
||||
);
|
||||
|
||||
GetOptions(\%opt,
|
||||
'v|verbose+',# verbose
|
||||
'help+', # write usage info
|
||||
'd|debug+', # debug
|
||||
's=s', # what to sort by (al, at, ar, ae, c, t, l, r, e)
|
||||
'r!', # reverse the sort order (largest last instead of first)
|
||||
't=i', # just show the top n queries
|
||||
'a!', # don't abstract all numbers to N and strings to 'S'
|
||||
'n=i', # abstract numbers with at least n digits within names
|
||||
'g=s', # grep: only consider stmts that include this string
|
||||
'h=s', # hostname/basename of db server for *-slow.log filename (can be wildcard)
|
||||
'i=s', # name of server instance (if using mysql.server startup script)
|
||||
'l!', # don't subtract lock time from total time
|
||||
) or usage("bad option");
|
||||
|
||||
$opt{'help'} and usage();
|
||||
|
||||
unless (@ARGV) {
|
||||
my $defaults = `my_print_defaults --mysqld`;
|
||||
|
||||
my $datadir = ($defaults =~ m/--datadir=(.*)/g)[-1];
|
||||
if (!$datadir or $opt{i}) {
|
||||
# determine the datadir from the instances section of /etc/my.cnf, if any
|
||||
my $instances = `my_print_defaults instances`;
|
||||
die "Can't determine datadir from 'my_print_defaults instances' output: $defaults"
|
||||
unless $instances;
|
||||
my @instances = ($instances =~ m/^--(\w+)-/mg);
|
||||
die "No -i 'instance_name' specified to select among known instances: @instances.\n"
|
||||
unless $opt{i};
|
||||
die "Instance '$opt{i}' is unknown (known instances: @instances)\n"
|
||||
unless grep { $_ eq $opt{i} } @instances;
|
||||
$datadir = ($instances =~ m/--$opt{i}-datadir=(.*)/g)[-1]
|
||||
or die "Can't determine --$opt{i}-datadir from 'my_print_defaults instances' output: $instances";
|
||||
warn "datadir=$datadir\n" if $opt{v};
|
||||
}
|
||||
|
||||
my $slowlog = ($defaults =~ m/--log[-_]slow[-_]queries=(.*)/g)[-1];
|
||||
if (!$slowlog)
|
||||
{
|
||||
$slowlog = ($defaults =~ m/--slow[-_]query[-_]log[-_]file=(.*)/g)[-1];
|
||||
}
|
||||
if ( $slowlog )
|
||||
{
|
||||
@ARGV = ($slowlog);
|
||||
die "Can't find '$slowlog'\n" unless @ARGV;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$opt{h})
|
||||
{
|
||||
$opt{h}= ($defaults =~ m/--log[-_]basename=(.*)/g)[-1];
|
||||
}
|
||||
@ARGV = <$datadir/$opt{h}-slow.log>;
|
||||
die "Can't find '$datadir/$opt{h}-slow.log'\n" unless @ARGV;
|
||||
}
|
||||
}
|
||||
|
||||
warn "\nReading mysql slow query log from @ARGV\n";
|
||||
|
||||
my @pending;
|
||||
my %stmt;
|
||||
$/ = ";\n#"; # read entire statements using paragraph mode
|
||||
while ( defined($_ = shift @pending) or defined($_ = <>) ) {
|
||||
warn "[[$_]]\n" if $opt{d}; # show raw paragraph being read
|
||||
|
||||
my @chunks = split /^\/.*Version.*started with[\000-\377]*?Time.*Id.*Command.*Argument.*\n/m;
|
||||
if (@chunks > 1) {
|
||||
unshift @pending, map { length($_) ? $_ : () } @chunks;
|
||||
warn "<<".join(">>\n<<",@chunks).">>" if $opt{d};
|
||||
next;
|
||||
}
|
||||
|
||||
s/^#? Time: \d{6}\s+\d+:\d+:\d+.*\n//;
|
||||
my ($user,$host) = s/^#? User\@Host:\s+(\S+)\s+\@\s+(\S+).*\n// ? ($1,$2) : ('','');
|
||||
|
||||
s/^# Thread_id: [0-9]+\s+Schema: .*\s+QC_hit:.*[^\n]+\n//;
|
||||
s/^# Query_time: ([0-9.]+)\s+Lock_time: ([0-9.]+)\s+Rows_sent: ([0-9.]+)\s+Rows_examined: ([0-9.]+).*\n//;
|
||||
my ($t, $l, $r, $e) = ($1, $2, $3, $4);
|
||||
s/^# Rows_affected: ([0-9.]+).*\n//;
|
||||
my ($a) = ($1);
|
||||
|
||||
$t -= $l unless $opt{l};
|
||||
|
||||
# remove fluff that mysqld writes to log when it (re)starts:
|
||||
s!^/.*Version.*started with:.*\n!!mg;
|
||||
s!^Tcp port: \d+ Unix socket: \S+\n!!mg;
|
||||
s!^Time.*Id.*Command.*Argument.*\n!!mg;
|
||||
|
||||
# Remove optimizer info
|
||||
s!^# QC_Hit: \S+\s+Full_scan: \S+\s+Full_join: \S+\s+Tmp_table: \S+\s+Tmp_table_on_disk: \S+[^\n]+\n!!mg;
|
||||
s!^# Filesort: \S+\s+Filesort_on_disk: \S+[^\n]+\n!!mg;
|
||||
s!^# Full_scan: \S+\s+Full_join: \S+[^\n]+\n!!mg;
|
||||
|
||||
s/^use \w+;\n//; # not consistently added
|
||||
s/^SET timestamp=\d+;\n//;
|
||||
|
||||
s/^[ ]*\n//mg; # delete blank lines
|
||||
s/^[ ]*/ /mg; # normalize leading whitespace
|
||||
s/\s*;\s*(#\s*)?$//; # remove trailing semicolon(+newline-hash)
|
||||
|
||||
next if $opt{g} and !m/$opt{g}/io;
|
||||
|
||||
unless ($opt{a}) {
|
||||
s/\b\d+\b/N/g;
|
||||
s/\b0x[0-9A-Fa-f]+\b/N/g;
|
||||
s/''/'S'/g;
|
||||
s/""/"S"/g;
|
||||
s/(\\')//g;
|
||||
s/(\\")//g;
|
||||
s/'[^']+'/'S'/g;
|
||||
s/"[^"]+"/"S"/g;
|
||||
# -n=8: turn log_20001231 into log_NNNNNNNN
|
||||
s/([a-z_]+)(\d{$opt{n},})/$1.('N' x length($2))/ieg if $opt{n};
|
||||
# abbreviate massive "in (...)" statements and similar
|
||||
s!(([NS],){100,})!sprintf("$2,{repeated %d times}",length($1)/2)!eg;
|
||||
}
|
||||
|
||||
my $s = $stmt{$_} ||= { users=>{}, hosts=>{} };
|
||||
$s->{c} += 1;
|
||||
$s->{t} += $t;
|
||||
$s->{l} += $l;
|
||||
$s->{r} += $r;
|
||||
$s->{e} += $e;
|
||||
$s->{a} += $a;
|
||||
$s->{users}->{$user}++ if $user;
|
||||
$s->{hosts}->{$host}++ if $host;
|
||||
|
||||
warn "{{$_}}\n\n" if $opt{d}; # show processed statement string
|
||||
}
|
||||
|
||||
foreach (keys %stmt) {
|
||||
my $v = $stmt{$_} || die;
|
||||
my ($c, $t, $l, $r, $e, $a) = @{ $v }{qw(c t l r e a)};
|
||||
$v->{at} = $t / $c;
|
||||
$v->{al} = $l / $c;
|
||||
$v->{ar} = $r / $c;
|
||||
$v->{ae} = $e / $c;
|
||||
$v->{aa} = $a / $c;
|
||||
}
|
||||
|
||||
my @sorted = sort { $stmt{$b}->{$opt{s}} <=> $stmt{$a}->{$opt{s}} } keys %stmt;
|
||||
@sorted = @sorted[0 .. $opt{t}-1] if $opt{t};
|
||||
@sorted = reverse @sorted if $opt{r};
|
||||
|
||||
foreach (@sorted) {
|
||||
my $v = $stmt{$_} || die;
|
||||
my ($c, $t, $at, $l, $al, $r, $ar, $e, $ae, $a, $aa) = @{ $v }{qw(c t at l al r ar e ae a aa)};
|
||||
my @users = keys %{$v->{users}};
|
||||
my $user = (@users==1) ? $users[0] : sprintf "%dusers",scalar @users;
|
||||
my @hosts = keys %{$v->{hosts}};
|
||||
my $host = (@hosts==1) ? $hosts[0] : sprintf "%dhosts",scalar @hosts;
|
||||
printf "Count: %d Time=%.2fs (%ds) Lock=%.2fs (%ds) Rows_sent=%.1f (%d), Rows_examined=%.1f (%d), Rows_affected=%.1f (%d), $user\@$host\n%s\n\n",
|
||||
$c, $at,$t, $al,$l, $ar,$r, $ae, $e, $aa, $a, $_;
|
||||
}
|
||||
|
||||
sub usage {
|
||||
my $str= shift;
|
||||
my $text= <<HERE;
|
||||
Usage: mysqldumpslow [ OPTS... ] [ LOGS... ]
|
||||
|
||||
Parse and summarize the MySQL slow query log. Options are
|
||||
|
||||
--verbose verbose
|
||||
--debug debug
|
||||
--help write this text to standard output
|
||||
|
||||
-v verbose
|
||||
-d debug
|
||||
-s ORDER what to sort by (al, at, ar, ae, c, l, r, e, t), 'at' is default
|
||||
al: average lock time
|
||||
ar: average rows sent
|
||||
at: average query time
|
||||
aa: average rows affected
|
||||
c: count
|
||||
l: lock time
|
||||
r: rows sent
|
||||
t: query time
|
||||
-r reverse the sort order (largest last instead of first)
|
||||
-t NUM just show the top n queries
|
||||
-a don't abstract all numbers to N and strings to 'S'
|
||||
-n NUM abstract numbers with at least n digits within names
|
||||
-g PATTERN grep: only consider stmts that include this string
|
||||
-h HOSTNAME hostname of db server for *-slow.log filename (can be wildcard),
|
||||
default is '*', i.e. match all
|
||||
-i NAME name of server instance (if using mysql.server startup script)
|
||||
-l don't subtract lock time from total time
|
||||
|
||||
HERE
|
||||
if ($str) {
|
||||
print STDERR "ERROR: $str\n\n";
|
||||
print STDERR $text;
|
||||
exit 1;
|
||||
} else {
|
||||
print $text;
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
1161
codes/agent/dbbackup/mysql/mysqlhotcopy.pl
Normal file
1161
codes/agent/dbbackup/mysql/mysqlhotcopy.pl
Normal file
File diff suppressed because it is too large
Load Diff
BIN
codes/agent/dbbackup/mysql/mysqlimport.exe
Normal file
BIN
codes/agent/dbbackup/mysql/mysqlimport.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/mysqlshow.exe
Normal file
BIN
codes/agent/dbbackup/mysql/mysqlshow.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/mysqlslap.exe
Normal file
BIN
codes/agent/dbbackup/mysql/mysqlslap.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/mysqltest.exe
Normal file
BIN
codes/agent/dbbackup/mysql/mysqltest.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/mysqltest_embedded.exe
Normal file
BIN
codes/agent/dbbackup/mysql/mysqltest_embedded.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/perror.exe
Normal file
BIN
codes/agent/dbbackup/mysql/perror.exe
Normal file
Binary file not shown.
BIN
codes/agent/dbbackup/mysql/replace.exe
Normal file
BIN
codes/agent/dbbackup/mysql/replace.exe
Normal file
Binary file not shown.
122
codes/agent/dbbackup/mysql/script/player.sql
Normal file
122
codes/agent/dbbackup/mysql/script/player.sql
Normal file
File diff suppressed because one or more lines are too long
102
codes/agent/dbbackup/mysql/script/sales_buybill.sql
Normal file
102
codes/agent/dbbackup/mysql/script/sales_buybill.sql
Normal file
File diff suppressed because one or more lines are too long
110
codes/agent/dbbackup/mysql/script/sales_sellbill.sql
Normal file
110
codes/agent/dbbackup/mysql/script/sales_sellbill.sql
Normal file
File diff suppressed because one or more lines are too long
62
codes/agent/dbbackup/mysql/script/sales_transferbill.sql
Normal file
62
codes/agent/dbbackup/mysql/script/sales_transferbill.sql
Normal file
File diff suppressed because one or more lines are too long
111
codes/agent/dbbackup/mysql/script/sales_user.sql
Normal file
111
codes/agent/dbbackup/mysql/script/sales_user.sql
Normal file
File diff suppressed because one or more lines are too long
135
codes/agent/dbbackup/mysql/新建文本文档.txt
Normal file
135
codes/agent/dbbackup/mysql/新建文本文档.txt
Normal file
@@ -0,0 +1,135 @@
|
||||
insert into
|
||||
ct_user_commission
|
||||
(
|
||||
agent_id,
|
||||
channel_id,
|
||||
game_id,
|
||||
player_id,
|
||||
user_id,
|
||||
parent_user_id,
|
||||
room_code,
|
||||
used_card,
|
||||
owner_id,
|
||||
room_type,
|
||||
room_mode,
|
||||
commission_type,
|
||||
grade,
|
||||
mode,
|
||||
type,
|
||||
commission_total,
|
||||
commission_system,
|
||||
commission_user,
|
||||
commission_parent_user,
|
||||
commission_user_rate,
|
||||
commission_parent_user_rate,
|
||||
create_time,
|
||||
out_id
|
||||
)
|
||||
select
|
||||
agent_id,
|
||||
channel_id,
|
||||
game_id,
|
||||
player_id,
|
||||
user_id,
|
||||
parent_user_id,
|
||||
room_code,
|
||||
used_card,
|
||||
owner_id,
|
||||
room_type,
|
||||
room_mode,
|
||||
commission_type,
|
||||
grade,
|
||||
mode,
|
||||
type,
|
||||
ifnull(commission_total, 0),
|
||||
ifnull(commission_total, 0) - floor(ifnull(commission_total, 0) * ifnull(user_rate, 0)) - floor(ifnull(commission_total, 0) * ifnull(parent_user_rate, 0)),
|
||||
floor(ifnull(commission_total, 0) * ifnull(user_rate, 0)),
|
||||
floor(ifnull(commission_total, 0) * ifnull(parent_user_rate, 0)),
|
||||
ifnull(user_rate, 0),
|
||||
ifnull(parent_user_rate, 0),
|
||||
create_time,
|
||||
out_id
|
||||
from
|
||||
(
|
||||
select
|
||||
a.agent_id,
|
||||
a.channel_id,
|
||||
a.game_id,
|
||||
a.player_id,
|
||||
a.user_id,
|
||||
a.parent_user_id,
|
||||
a.room_code,
|
||||
a.used_card,
|
||||
a.owner_id,
|
||||
a.room_type,
|
||||
a.room_mode,
|
||||
a.commission_type,
|
||||
a.grade,
|
||||
a.mode,
|
||||
a.type,
|
||||
a.commission_total,
|
||||
case
|
||||
when (0 = a.user_id) or (0 != a.user_is_admin) then 0
|
||||
else case ifnull(c.is_custom, 0)
|
||||
when 0 then b.user_commission_rate
|
||||
else c.commission_rate
|
||||
end
|
||||
end +
|
||||
case
|
||||
when ((0 != a.user_id) and (0 = a.user_is_admin)) and ((0 = a.parent_user_id) or (0 != a.parent_user_is_admin)) then
|
||||
case ifnull(c.is_custom, 0)
|
||||
when 0 then b.parent_user_commission_rate
|
||||
else c.parent_commission_rate
|
||||
end
|
||||
else 0
|
||||
end user_rate,
|
||||
case
|
||||
when (0 = a.parent_user_id) or (0 != a.parent_user_is_admin) then 0
|
||||
else case ifnull(c.is_custom, 0)
|
||||
when 0 then b.parent_user_commission_rate
|
||||
else c.parent_commission_rate
|
||||
end
|
||||
end parent_user_rate,
|
||||
a.user_is_admin,
|
||||
a.parent_user_is_admin,
|
||||
a.create_time,
|
||||
a.out_id
|
||||
from
|
||||
(
|
||||
select
|
||||
a.core_agentid agent_id,
|
||||
b.play_channelid channel_id,
|
||||
a.core_gameid game_id,
|
||||
a.core_playerid player_id,
|
||||
ifnull(b.play_invitecode, 0) user_id,
|
||||
ifnull(c.global_power, 0) user_is_admin,
|
||||
ifnull(c.saus_parentid, 0) parent_user_id,
|
||||
ifnull(d.global_power, 0) parent_user_is_admin,
|
||||
a.core_roomcode room_code,
|
||||
a.core_roomcard used_card,
|
||||
a.core_ownerid owner_id,
|
||||
a.core_roomtype room_type,
|
||||
a.core_roommode room_mode,
|
||||
case a.core_roommode
|
||||
when 0 then '001'
|
||||
when 1 then '002'
|
||||
else '001'
|
||||
end commission_type,
|
||||
a.core_grade grade,
|
||||
a.core_mode mode,
|
||||
a.core_datatype type,
|
||||
a.core_value commission_total,
|
||||
a.core_time create_time,
|
||||
a.idx out_id
|
||||
from
|
||||
coin_rebate a left join
|
||||
player b on a.core_agentid = b.play_agentid and a.core_playerid = b.play_playerid left join
|
||||
sales_user c on b.play_agentid = c.saus_agentid and b.play_channelid = c.saus_channelid and b.play_invitecode = c.saus_salesid left join
|
||||
sales_user d on c.saus_agentid = d.saus_agentid and c.saus_channelid = d.saus_channelid and c.saus_parentid = d.saus_salesid
|
||||
) a left join ct_agent_commission b on a.agent_id = b.agent_id and a.channel_id = b.channel_id and a.commission_type = b.type_id left join
|
||||
ct_agent_commission_user c on a.agent_id = c.agent_id and a.channel_id = c.channel_id and b.type_id = c.type_id and a.user_id = c.user_id
|
||||
) t
|
||||
where
|
||||
t.out_id not in (select out_id from ct_user_commission)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user