[root@localhost bin]# ./sync_ctrl start
start the sync_d ....
start the sync_d 0....
Target:sync_d 0 is running with pid 143899 ...
start ok
[root@localhost bin]# ./sync_ctrl status
sync_d 0 is down

命令启动后,没有真的启动,db_sync_short_video_oss_r2m0_d也没有打日志

drwxr-xr-x. 2 root root 4096 May 16 00:10 sdaiostat_d
drwxr-xr-x. 2 root root 4096 May 16 16:28 shardadmin_d
drwxr-xr-x. 2 root root 4096 May 16 17:48 shardadmin_short_video_oss_20_d
drwxr-xr-x. 2 root root 4096 May 16 16:28 shard_d
drwxr-xr-x. 2 root root 4096 May 16 16:28 shard_short_video_oss_200_d
drwxr-xr-x. 2 root root 4096 May 16 16:28 shard_short_video_oss_20b_d
drwxr-xr-x. 2 root root 4096 May 16 16:28 shard_short_video_oss_20c_d
drwxr-xr-x. 2 root root 4096 May 16 16:28 shard_short_video_oss_20d_d
drwxr-xr-x. 2 root root 4096 May 16 16:28 shard_short_video_oss_20e_d
drwxr-xr-x. 2 root root 4096 May 16 16:28 shard_short_video_oss_20f_d
drwxr-xr-x. 2 root root 4096 May 16 16:28 shard_short_video_oss_210_d
drwxr-xr-x. 2 root root 4096 May 16 16:28 shard_short_video_oss_211_d

可以看sync_d日志,当同步进程成功启动后,会变成db_sync_short_video_oss_r2m0_d目录,目前看日志有如下报错

May 17 15:42:17 warning sync_d[]: [tid:143826] [MetaData::loadGlobalInfo] myshard_user empty 'SYNC'
May 17 15:42:17 crit sync_d[]: [tid:143826] [MetaData::loadSyncInfo] Unknown column 'area_no' in 'field list'
May 17 15:45:58 warning sync_d[]: [tid:143899] [MetaData::loadGlobalInfo] myshard_user empty 'SYNC'
May 17 15:45:58 crit sync_d[]: [tid:143899] [MetaData::loadSyncInfo] Unknown column 'area_no' in 'field list'

说缺少了一个叫area_no的字段,这个需要在sync_server表多加入一个字段

alter table myshard_sync_server add area_no int(11) DEFAULT 1;

同时在myshard.xml上的area字段,也改为1,这个表示区域号,美洲区,欧洲区,亚洲区的编号

[root@localhost sync_r1m0]# cat /data/rds/myshard/bin/myshard.xml
<?xml version="1.0" encoding="utf-8" ?>
<conf>
    <business alias="short_video_oss">short_video_oss</business>
    <group name="">1</group>
    <station>0</station>
    <area>1</area>
    <center-mode>0</center-mode>
    <metadata-db>
        <ip>127.0.0.1</ip>
        <port>6301</port>
        <db>myshard_metadata</db>
        <user>XXXXX</user>
        <pass>XXXXXX</pass>
    </metadata-db>
    <metadata-db-backup>
        <ip>127.0.0.1</ip>
        <port>6301</port>
        <db>myshard_metadata</db>
        <user>XXXXXX</user>
        <pass>XXXXX</pass>
    </metadata-db-backup>
    <sync>
        <log-expire-days>2</log-expire-days>
    </sync>
</conf>

为了加载元数据,重启shard,shardadmin,sync,重启完以后,看一下重启的时间是不是刚刚,这样保证是已经成功重启的,另外所有节点都加入nc脚本,同时去看是否有人来拉取自己的数据

shard_local             Read_offset             1052            
shard_local             Read_speed              0               
shard_local             Read_bytes_behind       0               
sync_r2m0               Read_offset             1052            
sync_r2m0               Read_speed              0               
sync_r2m0               Read_bytes_behind       0               
sync_r3m0               Read_offset             1052            
sync_r3m0               Read_speed              0               
sync_r3m0               Read_bytes_behind       0               
sync_r4m0               Read_offset             1052            
sync_r4m0               Read_speed              0               
sync_r4m0               Read_bytes_behind       0               
shard_remote            Read_offset             698             
shard_remote            Read_speed              0               
shard_remote            Read_bytes_behind       0