-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding util_ms.sh for CMC to replace util.sh
FormatDisk now adds a 32Gib swap file referencing byol_2019 in parameters.json
- Loading branch information
Showing
4 changed files
with
116 additions
and
5 deletions.
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,106 @@ | ||
#!/usr/bin/env bash | ||
|
||
adjustTCPKeepalive () | ||
{ | ||
# Azure public IPs have some odd keep alive behaviour | ||
|
||
echo "Setting TCP keepalive..." | ||
sysctl -w net.ipv4.tcp_keepalive_time=120 | ||
|
||
echo "Setting TCP keepalive permanently..." | ||
echo "net.ipv4.tcp_keepalive_time = 120 | ||
" >> /etc/sysctl.conf | ||
} | ||
|
||
formatDataDisk () | ||
{ | ||
# This script formats and mounts the drive on lun0 as /datadisk | ||
# It also sets the swap file to 32GB on /mnt which is the temporary disk on /dev/sdb | ||
|
||
SWAPFILE="/mnt/swapFile.swap" | ||
|
||
echo "Creating and formating a new swap file ..." | ||
|
||
fallocate -l 1g ${SWAPFILE} | ||
chmod 600 ${SWAPFILE} | ||
echo "Formating the swap file ..." | ||
mkswap ${SWAPFILE} | ||
echo "Enabling the swap file ..." | ||
swapon ${SWAPFILE} | ||
echo "${SWAPFILE} swap swap defaults 0 0" | sudo tee -a /etc/fstab | ||
|
||
DISK="/dev/disk/azure/scsi1/lun0" | ||
PARTITION="/dev/disk/azure/scsi1/lun0-part1" | ||
MOUNTPOINT="/datadisk" | ||
|
||
echo "Partitioning the disk." | ||
echo "g | ||
n | ||
p | ||
1 | ||
t | ||
83 | ||
w"| fdisk ${DISK} | ||
|
||
echo "Waiting for the symbolic link to be created..." | ||
udevadm settle --exit-if-exists=$PARTITION | ||
|
||
echo "Creating the filesystem." | ||
mkfs -j -t ext4 ${PARTITION} | ||
|
||
echo "Updating fstab" | ||
LINE="${PARTITION}\t${MOUNTPOINT}\text4\tnoatime,nodiratime,nodev,noexec,nosuid\t1\t2" | ||
echo -e ${LINE} >> /etc/fstab | ||
|
||
echo "Mounting the disk" | ||
mkdir -p $MOUNTPOINT | ||
mount -a | ||
|
||
echo "Changing permissions" | ||
chown couchbase $MOUNTPOINT | ||
chgrp couchbase $MOUNTPOINT | ||
} | ||
|
||
turnOffTransparentHugepages () | ||
{ | ||
echo "#!/bin/bash | ||
### BEGIN INIT INFO | ||
# Provides: disable-thp | ||
# Required-Start: $local_fs | ||
# Required-Stop: | ||
# X-Start-Before: couchbase-server | ||
# Default-Start: 2 3 4 5 | ||
# Default-Stop: 0 1 6 | ||
# Short-Description: Disable THP | ||
# Description: disables Transparent Huge Pages (THP) on boot | ||
### END INIT INFO | ||
echo 'never' > /sys/kernel/mm/transparent_hugepage/enabled | ||
echo 'never' > /sys/kernel/mm/transparent_hugepage/defrag | ||
" > /etc/init.d/disable-thp | ||
chmod 755 /etc/init.d/disable-thp | ||
service disable-thp start | ||
update-rc.d disable-thp defaults | ||
} | ||
|
||
setSwappinessToZero () | ||
{ | ||
sysctl vm.swappiness=0 | ||
echo " | ||
# Required for Couchbase | ||
vm.swappiness = 0 | ||
" >> /etc/sysctl.conf | ||
} | ||
|
||
addCBGroup () | ||
{ | ||
$username = $1 | ||
$password = $2 | ||
path = ${3-'/opt/couchbase/bin/'} | ||
cli=${path}couchbase-cli group-manage | ||
ls $path | ||
$cli --username $username --password $password --create --group-name | ||
#runs in the directory where couchbase is installed | ||
} |
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