mycat DDL的專案實踐

2021-10-24 20:22:00 字數 1843 閱讀 6099

mycat支援的常見的ddl語句的。

根據測試,在mycat裡,進行了分庫的表,是不支援 create table操作的。比如下表

(1)如果是.sql檔案,寫入臨時檔案,後期用 mysql -u -p -p8066 < $myfile進行匯入

(2) 如果 是sh 檔案,直接對sh 檔案進行執行

注: 在sh 裡,將建表語句 ,寫入txt ,防止 s**件裡`` 這個符號 引起 命令執行失敗。

(3) 如果是.xml 檔案,則意味著mycat裡的 rule.xml schema.xml需要更新。

注: 特例186環境,使用docker mysql3310取代了3306 裡的pdas靜態表,所以在這裡作了判斷 ,如果存在3310則不進行schema.xml替換 ,自家環境,手動處理。 

if [ "$"x = "sql"x ];then

echo "source $file_root/$i/$" >>$myfile

elif [ "$"x = "sh"x ];then

chmod +x $file_root/$i/$

cd $file_root/$i

echo " i will exec $file_root/$i/$"

sh $file_root/$i/$

elif [ "$"x = "xml"x ];then

docker ps|grep mysql3310| tee /tmp/mysql3310.log

cat /tmp/mysql3310.log | grep -w mysql3310

rr=$?

if [ $rr -ne 0 ]; then

echo "沒有發現mysql3310"

echo $rr

else

echo "ok!,mysql3310 exists! don't cover the xml of mycat !"

echo $rr

continue

fitt=`sed -n '/mycattype=/p' /alidata/globalcheck.sh`

echo $tt

tt1=`echo $`

tt2=`echo $`

echo $tt2;

if [ "$tt2"x == "1"x ];then

cp -f $install_path/chinese/rule.xml /alidata/server/mycat/conf/rule.xml

cp -f $install_path/chinese/schema.xml.1 /alidata/server/mycat/conf/schema.xml

elif [ "$tt2"x == "2"x ];then

cp -f $install_path/chinese/rule.xml /alidata/server/mycat/conf/rule.xml

cp -f $install_path/chinese/schema.xml.2 /alidata/server/mycat/conf/schema.xml

else

echo "mycat type error!"

fi/alidata/server/mycat/bin/mycat restart &

else

echo 'do nothin';fi

經過優化,src/sql/largeupdate/20200423

參考這個資料夾下的寫法,每次只要寫一行即可。 因為引用了公共抽像檔案multi_table.sh

#! /bin/bash

. ../multi_table.sh

exec dn traffic

與專案實踐

模型 描述業務 業務規則 系統使用 應用程式 系統架構以及系統內互動的一種視覺化方式。便於理解業務 需求,理解軟體和架構如何構造。美國前 艾森豪威爾說 計畫是零,計畫的過程是一切。模型本身並不是最重要的,建立模型的過程和經歷得思考才是最具價值。建模可以強迫你去思考,通過充分的思考,你就可以做出最好的...

CMake 專案實踐

基本語法 linux 下 opencv cmake 平台選擇 參考 win10 cmake mingw 簡單使用 編寫原始碼和cmakelists.txt 在原始碼路徑下新建子目錄build,並進入 執行命令cmake g mingw makefiles win下只生成makefiles,省得出現各...

MVC專案實踐

mvc專案實踐 1.增添新聞 h1 發布新聞 h1 form action insert method post input type text name title br input type text name author br input type text name source br 內...