sshfs

# 建立共享連結
sshfs [username]@[ip]:/[共享來源] [讀取共享來源的地方] -o allow_other

# 建立共享連結(加上key的檔案)
sshfs [username]@[ip]:/[共享來源] [讀取共享來源的地方] -o IdentityFile=[私鑰位置]

# 測試各節點權限,若成功則會新增test資料夾,共享來源與所有讀取處都會同步
sudo -u elasticsearch touch [讀取共享來源的地方]/test

# 查看是否設定成功
df

# 清除連結,成功後內容會清空並不再與共享來源同步
sudo umount [讀取共同來源的位置]

gcp上IdentityFile的方式確實有辦法同步,但是會出現權限問題(無法touch)

需要更改vm中ssh的設定(參考/Linux/ssh)後,以allow_other設定sshfs就可以惹

參考連結: https://www.cnblogs.com/jiangzuo/p/8006635.html https://blog.csdn.net/moxiaomomo/article/details/78401400 http://fichugh.blogspot.com/2017/07/sshfs.html

加上pem檔案 https://stackoverflow.com/questions/22217767/how-to-mount-a-folder-on-amazon-ec2-instance-with-private-key-using-sshfs

Last updated