-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e47b125
commit ff7f1c8
Showing
3 changed files
with
15 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
for i in mysql1 mysql2 mysql3; do | ||
docker exec mysync_${i}_1 rm /root/.ssh/id_rsa | ||
docker exec mysync_${i}_1 ssh-keygen -m PEM -t rsa -b 2048 -N '' -C root@mysync_${i}_1 -f /root/.ssh/id_rsa | ||
done | ||
|
||
for i in mysql1 mysql2 mysql3; do | ||
docker cp mysync_${i}_1:/root/.ssh/id_rsa.pub id_rsa.pub | ||
for j in mysql1 mysql2 mysql3; do | ||
cat id_rsa.pub | ||
docker exec mysync_${j}_1 /bin/bash -c "echo '$(cat id_rsa.pub)' >>/root/.ssh/authorized_keys" | ||
done | ||
done | ||
|
||
rm id_rsa.pub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters