Created
October 31, 2021 10:58
-
-
Save susimsek/97dcf749dc63a5934d336d29cf27d985 to your computer and use it in GitHub Desktop.
Nfs Server Change Path
This file contains hidden or 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
| #!/bin/bash | |
| NFS_DIR=/srv/kubedata | |
| TARGET_PATH=$NFS_DIR/fabricfiles | |
| FABRIC_FILES_PATH=/vagrant/k8s/fabricfiles | |
| # Functions ######################################################################### | |
| function copy_fabricfiles(){ | |
| echo "## Copied fabric files" | |
| echo | |
| sudo cp -a $FABRIC_FILES_PATH/. $TARGET_PATH/ | |
| sudo chmod -R 777 $TARGET_PATH/ | |
| } | |
| # Let's go ################################################################################### | |
| copy_fabricfiles |
This file contains hidden or 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
| #!/bin/bash | |
| NFS_DIR=/srv/kubedata | |
| FABRIC_FILES_PATH=$NFS_DIR/fabricfiles | |
| BROKER_PATH=$NFS_DIR/fabricfiles/broker | |
| # Functions ######################################################################### | |
| function create_fabricfiles_dir(){ | |
| echo "## Created fabric files path" | |
| echo | |
| sudo mkdir $FABRIC_FILES_PATH | |
| sudo chown -R nobody:nogroup $FABRIC_FILES_PATH | |
| sudo chmod -R 777 $FABRIC_FILES_PATH | |
| } | |
| function create_broker_dir(){ | |
| echo "## Created broker path" | |
| echo | |
| sudo mkdir -p $BROKER_PATH | |
| sudo mkdir $BROKER_PATH/zookeeper0 | |
| sudo mkdir $BROKER_PATH/zookeeper1 | |
| sudo mkdir $BROKER_PATH/kafka0 | |
| sudo mkdir $BROKER_PATH/kafka1 | |
| sudo chmod -R 777 $BROKER_PATH | |
| } | |
| # Let's go ################################################################################### | |
| create_fabricfiles_dir | |
| create_broker_dir |
This file contains hidden or 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
| #!/bin/bash | |
| # install nfs server | |
| # get some variables ##################################################################### | |
| IP_RANGE=$(dig +short k8smaster | grep -v 127.0 | sed s/".[0-9]*$"/.0/g) | |
| NFS_PATH=/srv/kubedata | |
| # Functions ##################################################################### | |
| prepare_directories(){ | |
| sudo mkdir -p ${NFS_PATH} | |
| sudo chmod 777 -R ${NFS_PATH} | |
| } | |
| install_nfs(){ | |
| sudo apt-get install -y nfs-kernel-server 2>&1 > /dev/null | |
| } | |
| set_nfs(){ | |
| sudo echo "${NFS_PATH} ${IP_RANGE}/24(rw,sync,no_root_squash,no_subtree_check)">/etc/exports | |
| } | |
| run_nfs(){ | |
| sudo systemctl restart nfs-server rpcbind | |
| sudo exportfs -a | |
| } | |
| # Let's go ####################################################################### | |
| prepare_directories | |
| install_nfs | |
| set_nfs | |
| run_nfs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment