Advertisement
hjaltiatlason

nfs_share_docker

Oct 22nd, 2020
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. Pre-requisite
  2. Update the file with your node ip address
  3. vi /etc/exports
  4.  
  5. /root/nfs 192.168.1xx.xxx(rw,sync,no_root_squash,no_subtree_check)
  6. /root/nfs 192.168.1xx.1xx(rw,sync,no_root_squash,no_subtree_check)
  7. /root/nfs 192.168.xxx.1xx(rw,sync,no_root_squash,no_subtree_check)
  8.  
  9. exportfs -a
  10.  
  11. -------------------------------------------------------------------------------------------------
  12. On Docker nodes install nfs utils
  13.  
  14. yum install nfs-utils
  15.  
  16. ----------------------------------------------------------------------------------------------------
  17. Add firewall exceptions
  18.  
  19. firewall-cmd --permanent --zone=public --add-service=nfs
  20. firewall-cmd --reload
  21. ---------------------------------------------------------------------------------------------------
  22. Create NFS docker volume on all nodes
  23.  
  24. docker volume create --driver local --name db_data --opt type=nfs4 --opt device=:/root/nfs/data --opt o=addr=192.168.xxx.1xx,rw,nolock
  25.  
  26. ---------------------------------------------------------------------------------------------------
  27. Create Docker service with NFS volume
  28.  
  29. docker service create --name db --network mynetwork --mount type=volume,source=db_data,target=/var/lib/postgresql/data -e POSTGRES_PASSWORD=password --replicas 2 postgres:9.4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement