diff --git a/extensions/server.sh b/extensions/server.sh index d98cf7c..398e1a5 100755 --- a/extensions/server.sh +++ b/extensions/server.sh @@ -65,20 +65,25 @@ echo "Running couchbase-cli node-init" --node-init-hostname=$nodeDNS \ --node-init-data-path=/datadisk/data \ --node-init-index-path=/datadisk/index \ + --node-init-analytics-path=/datadisk/analytics \ --user=$adminUsername \ --pass=$adminPassword if [[ $nodeIndex == "0" ]] then totalRAM=$(grep MemTotal /proc/meminfo | awk '{print $2}') - dataRAM=$((50 * $totalRAM / 100000)) - indexRAM=$((15 * $totalRAM / 100000)) + dataRAM=$((45 * $totalRAM / 100000)) + indexRAM=$((8 * $totalRAM / 100000)) echo "Running couchbase-cli cluster-init" ./couchbase-cli cluster-init \ --cluster=$nodeDNS \ --cluster-ramsize=$dataRAM \ --cluster-index-ramsize=$indexRAM \ + --index-storage-setting=memopt \ + --cluster-analytics-ramsize=$indexRAM \ + --cluster-fts-ramsize=$indexRAM \ + --cluster-eventing-ramsize=$indexRAM \ --cluster-username=$adminUsername \ --cluster-password=$adminPassword \ --services=data,index,query,fts,eventing,analytics diff --git a/extensions/util_ms.sh b/extensions/util_ms.sh new file mode 100755 index 0000000..750eaa0 --- /dev/null +++ b/extensions/util_ms.sh @@ -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 +} diff --git a/generator/deployment_ms.py b/generator/deployment_ms.py index d736846..cb0caa9 100644 --- a/generator/deployment_ms.py +++ b/generator/deployment_ms.py @@ -533,7 +533,7 @@ def generateServer(region, group, vnetName, createVnet, subnetName, groupName, r "settings": { "fileUris": [ "[concat(variables('extensionUrl'), 'server_generator.sh')]", - "[concat(variables('extensionUrl'), 'util.sh')]" + "[concat(variables('extensionUrl'), 'util_ms.sh')]" ] }, "protectedSettings": { @@ -641,7 +641,7 @@ def generateSyncGateway(region, group, vnetName, createVnet, subnetName): "settings": { "fileUris": [ "[concat(variables('extensionUrl'), 'syncGateway.sh')]", - "[concat(variables('extensionUrl'), 'util.sh')]" + "[concat(variables('extensionUrl'), 'util_ms.sh')]" ] }, "protectedSettings": { diff --git a/generator/parameters/parameters.json b/generator/parameters/parameters.json index 8b00881..cfa0ed9 100644 --- a/generator/parameters/parameters.json +++ b/generator/parameters/parameters.json @@ -12,7 +12,7 @@ "value": "longpass12---" }, "license": { - "value": "byol" + "value": "byol_2019" }, "uniqueString": { "value": "n4f5pbg2ayvjc"