0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

いま再びのシステムまぎちゃんへの道~NFS祭り~

0
Posted at

共有領域がないと困ること困ること

並列計算で欠かせないのが共有ディレクトリを作ることです。
なぜかというと各マシンで同じ実行ファイルを見ているからです。
ですので、共有ディレクトリがないと、
1.実行ファイルを作る(プログラミング→コンパイル)
2.実行ファイルをばらまく(超めんどくさい)
3.あ、実行途中にバグった。(1.へ戻る)
を繰り返すはめになるので、面倒でしょ?

NFSの設定

NFSサーバ

ここでもAnsibleさんが大活躍、方法としては

  1. nfs-utilsの最新版をチェックして
  2. ファイアーウォールを設定して
  3. きちんとNFSの共有領域ができているかチェック
  4. NFS サーバの機動
    を実行するようにします。
nfs-server/tasks/main.yml
---
- name: check latest nfs-utils
  dnf:
    name: nfs-utils
    state: latest
    update_cache: yes

- name: set firewall
  shell: firewall-cmd --permanent --add-service nfs

- name: fix firewall
  shell: firewall-cmd --reload

- name: unmount directory
  shell: if [ -d /nfs/home/evakichi/ ];then umount /nfs/home;fi

- name: mount directory
  shell: mount $(blkid |grep "/dev/sda" |cut -d" " -f2|sed "s/UUID=\"\(.*\)*\"/UUID=\1/g") /nfs/home

- name: start nfs
  systemd:
    name: nfs-server
    enabled: true
    state: started

NFSクライアント

クライアントも、サーバとほぼ同じです。

  1. nfs-utilsの最新版をチェックして
  2. ファイアーウォールを設定して
  3. いったんファイアーウィールをアンマウントして(マウントしていたらの話です)
  4. NFSマウント実行
nfs-client/tasks/main.yml
---
- name: check latest nfs-utils
  dnf:
    name: nfs-utils
    state: latest
    update_cache: yes

- name: set firewall
  shell: firewall-cmd --permanent --add-service nfs

- name: fix firewall
  shell: firewall-cmd --reload

- name: unmount directory
  shell: if [ -d /nfs/home/lost+found ]; then umount /nfs/home; fi

- name: mount directory
  shell: mount -t nfs ctl:/nfs/home/ /nfs/home

てなかんじ、もう少し工夫すれば一個のファイルでNFSの構築ができそうです。
ミソは、NFSサーバが完全に起動してからクライアントがNFSマウントしに行かなければいけないのを書かないといけないことでしょうか…。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?