mysql 主从复制 参数_mysql习惯及主从复制参数设置

mysql 重复数据插入

replace into t(id, update_time) values(1, now());

replace into t(id, update_time) select 1, now();

MySQL replace into 有三种形式:

1. replace into tbl_name(col_name, ...) values(...)

2. replace into tbl_name(col_name, ...) select ...

3. replace into tbl_name set col_name=value, ...

/************************ svn linux ***************************/

sudo apt-get install subversion

svn checkout 地址 || svn co svn://远程地址 ./本地地址 --username 用户名 --password 密码

Available subcommands:

add

blame (praise, annotate, ann)

cat

changelist (cl)

checkout (co)

cleanup

commit (ci)

copy (cp)

delete (del, remove, rm)

diff (di)

export

help (?, h)

import

info

list (ls)

lock

log

merge

mergeinfo

mkdir

move (mv, rename, ren)

propdel (pdel, pd)

propedit (pedit, pe)

propget (pget, pg)

proplist (plist, pl)

propset (pset, ps)

resolve

resolved

revert

status (stat, st)

switch (sw)

unlock

update (up)

/************************ php数组比较 ***************************/

$q = array(1,2,30,40,50);

$s = array(1,2,4,8,9,9,34,2,12,324,3,34,343);

//共同的部分

$m=array_intersect($q,$s);

//老的数据

$old=array_diff($q,$m);

//新的数据

$new=array_diff($s,$m);

// 字段唯一值

ALTER TABLE `kcd_diamond` ADD UNIQUE(`dia_report_no`);

服务器启动命令:

/usr/sbin/nginx -c /etc/nginx/nginx.conf

// 设定历史命令的时间

// 查看端口占用情况

nwtstat -an

//

pclose(popen(‘/bin/bash /opt/lampp/htdocs/restart.sh‘,‘r‘));

// 杀掉进程

#!/bin/bash

ps x | grep ‘./wbserver‘ | grep -v grep | grep -v "‘./wbserver‘" | awk ‘{print $1}‘ | xargs kill -9

重新启动

/*********************************** MYSQL *****************************************************/

grant all privileges on *.* to [email protected] identified by ‘pass‘;

flush privileges;

查看MYSQL数据库中所有用户

mysql> SELECT DISTINCT CONCAT(‘User: ‘‘‘,user,[email protected],host,‘‘‘;‘) AS query FROM mysql.user;

mysqldump -uroot -p kcvdiamond kcd_diamond --where=" dia_sup_id=10020" > /home/diamond.sql

python 资料总结

安装pip

wget https://pypi.python.org/packages/source/p/pip/pip-7.1.2.tar.gz#md5=3823d2343d9f3aaab21cf9c917710196

wget https://pypi.python.org/packages/source/s/setuptools/setuptools-18.3.2.tar.gz#md5=d30c969065bd384266e411c446a86623

// 文件中查找字段

find . -name "*.log" | xargs grep ""

// find . -name "*.log" | xargs grep 192.168.3.75

// 主从复制mysql

CHANGE MASTER TO MASTER_HOST=‘server1‘,MASTER_USER=‘repl‘,MASTER_PASSWORD=‘p4ssword‘,MASTER_LOG_FILE=‘mysql-bin.000001‘,MASTER_LOG_POS=0;

// 导出数据

/opt/lampp/bin/mysqldump -uroot -p kcvdiamond -l -F > t1.sql

mysqldump -uroot -pIsmond258369 kcvdiamond kcd_diamond --where=" dia_sup_id=10020" > /home/hkgroup.sql

// 导入数据

/opt/lampp/bin/mysql -uroot -p kcvdiamond < t1.sql

replicate-do-table=hrsoft_share.表名# 只复制表名表

// 复制表数据

insert into dist_systerm_msg (mg_title,mg_cont,mg_type,mg_user,mg_time,mg_ipad_uuid,mg_ipad_token) (select mg_title,mg_cont,mg_type,mg_user,mg_time,mg_ipad_uuid,mg_ipad_token from dist_systerm_msg);

// 严格来说以下两点少用, 逃避错误

1.跳过指定数量的事务:

mysql>slave stop;

mysql>SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1 #跳过一个事务

mysql>slave start

2.修改mysql的配置文件,通过slave_skip_errors参数来跳所有错误或指定类型的错误

vi /etc/my.cnf

[mysqld]

#slave-skip-errors=1062,1053,1146 #跳过指定error no类型的错误

#slave-skip-errors=all #跳过所有错误

mysql> show slave status\G;

*************************** 1. row ***************************

Slave_IO_State: Waiting for master to send event

Master_Host: 192.168.3.136

Master_User: user

Master_Port: 3306

Connect_Retry: 60

Master_Log_File: mysql-bin.000004

Read_Master_Log_Pos: 2346

Relay_Log_File: localhost-relay-bin.000014

Relay_Log_Pos: 1106

Relay_Master_Log_File: mysql-bin.000004

Slave_IO_Running: Yes

Slave_SQL_Running: Yes

Replicate_Do_DB:

Replicate_Ignore_DB:

Replicate_Do_Table: test.t_test

Replicate_Ignore_Table:

Replicate_Wild_Do_Table:

Replicate_Wild_Ignore_Table:

Last_Errno: 0

Last_Error:

Skip_Counter: 0

Exec_Master_Log_Pos: 2346

Relay_Log_Space: 1283

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

Master_SSL_Verify_Server_Cert: No

Last_IO_Errno: 0

Last_IO_Error:

Last_SQL_Errno: 0

Last_SQL_Error:

Replicate_Ignore_Server_Ids:

Master_Server_Id: 1

Master_UUID: 4985efad-79a0-11e5-a6a0-000c29ced604

Master_Info_File: /opt/lampp/var/mysql/master.info

SQL_Delay: 0

SQL_Remaining_Delay: NULL

Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it

Master_Retry_Count: 86400

Master_Bind:

Last_IO_Error_Timestamp:

Last_SQL_Error_Timestamp:

Master_SSL_Crl:

Master_SSL_Crlpath:

Retrieved_Gtid_Set:

Executed_Gtid_Set:

Auto_Position: 0

原文:http://www.cnblogs.com/akidongzi/p/5525948.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值