运维开发网

Linux 免密码 双机信任拷贝 及 mysqldump

运维开发网 https://www.qedev.com 2020-06-21 12:37 出处:网络
A服务器:192.168.0.102 B服务器:192.168.0.103 A服务器:[[email protected] ~]# ssh-keygen -t rsa[[email protected] ~]# cat ~/.ssh/id_rsa.pub[[email protected] ~]# scp id_rsa.pub [ema
A服务器:192.168.0.102

B服务器:192.168.0.103

A服务器:

[[email protected] ~]# ssh-keygen -t rsa

[[email protected] ~]# cat ~/.ssh/id_rsa.pub

[[email protected] ~]# scp id_rsa.pub [email protected]:/root/.ssh/authorized_keys

B服务器:

[[email protected] ~]# ssh-keygen -t rsa

[[email protected] ~]# cat ~/.ssh/id_rsa.pub

[[email protected] ~]# scp id_rsa.pub [email protected]:/root/.ssh/authorized_keys

A服务器:

[[email protected] ~]## cat bak.sh

#!/bin/bash

mysqldump -uroot -p123456 ultrax > /root/dbbak/ultraxdate +%Y%m%ddate +%H:%M:%S.sql

scp /root/dbbak/ultrax*.sql [email protected]:/tmp

A服务器:

[[email protected] ~]## sh bak.sh

A服务器:

[[email protected] ~]# crontab -l

55 23 * /root/dbbak/bak.sh

定时拷贝或者手动拷贝 都不要密码了.

0

精彩评论

暂无评论...
验证码 换一张
取 消