흠~~ replication 을 설정하고
master 에서 insert, create, update 관련 쿼리를 실행하면
slave 에 정상적으로 적용 되는걸 확인하였습니다.
그런데.....
밑과 같이 c로 코딩후 실행을 하면
master 에는 정상적으로 insert 가 되는데
slave 에는 적용이 안되는 것입니다..
master 와 slave 에서 각각
show master status;
show slave status;
를 실행해서 보면 replication이 정상적으로 진행한것으로 나오는데~~
도통 이유를 알수 없습니다.
참고로 밑에 show master status; show slave status; 실행 했을때 나온
결과도 첨부 하였습니다~~~
혹시 이런 경험이 있었던 분이나~~
이유를 알고 계신분 계시면 답변좀 부탁드립니다 ㅜㅜ
c코드
mysql_init( &mysql );
if( !mysql_real_connect(&mysql,
"localhost",
"user",
"passwd",
NULL,
0,
NULL,
0) ){
printf("Failed to connect to databases\n");
}
memset( sqlstmt, 0x00, sizeof(sqlstmt) );
sprintf( sqlstmt, "INSERT LBS_PRI.test2(Date) values( now() );");
printf( "SQL : %s\n", sqlstmt );
if( mysql_real_query( &mysql, sqlstmt, strlen(sqlstmt)) ){
tmperrno = mysql_errno( &mysql );
sprintf(tmperrMsg, "%s", mysql_error(&mysql));
printf("Query failed:error[%d]errMsg[%s]\n", tmperrno, tmperrMsg );
}
master/slave 상태 정보~~
mysql> show master status\G;
*************************** 1. row ***************************
File: mysql-bin.000001
Position: 6005
Binlog_Do_DB: LBS_ADMIN,LBS_PRI,LBS_PRI_LOG
Binlog_Ignore_DB:
mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 210.116.110.133
Master_User: repli
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000001
Read_Master_Log_Pos: 6005
Relay_Log_File: tws-friend3-relay-bin.000003
Relay_Log_Pos: 6142
Relay_Master_Log_File: mysql-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 6005
Relay_Log_Space: 6142
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
|