To run same command on a cluster of Cassandra database.
1) Install sshpass on any of the node running Ubuntu, by doing
sudo apt-get install sshpass
2) Run this as a shell script
for value in 'nodetool status | grep -E "x[.]y[.]z*" | awk '{print $2}''
do
echo $value
sshpass -p 'password' ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null username@value -C "nohup nodetool repair > /dev/null 2>&1 &"
done
Tuesday, July 4, 2017
Installing software RAID in Ubuntu
#Install MDADM for RAID configuration
export DEBIAN_FRONTEND=noninteractive
sudo debconf-set-selections <<< "postfix postfix/mailname string your.hostname.com"
sudo debconf-set-selections <<< "pstfix postfix/main_mailer_type string 'No configuration'"
sudo apt-get -q -y install mdadm
export DEBIAN_FRONTEND=noninteractive
sudo debconf-set-selections <<< "postfix postfix/mailname string your.hostname.com"
sudo debconf-set-selections <<< "pstfix postfix/main_mailer_type string 'No configuration'"
sudo apt-get -q -y install mdadm
Uploading/Downloading files to blob storage in Azure from Ubuntu
Install Azure CLI click here for Installation steps
#Uploading file to blob storage in Azure from Ubuntu/Debian
az login
export AZURE_STORAGE_ACCOUNT=your-classic-storage-account--no_need_of_any_quotes
export AZURE_STORAGE_ACCESS_KEY=your-access-key--available-with-storage-account-onportal--no_need_of_any_quotes
export container_name=any-container-name
export blob_name=any_filename_that_you_wish_to_keep_for_uploaded_file
echo "uploading the file"
az storage blob upload -f file_complete_path -c $container_name -n $blog_name
echo "downloading the file"
az storage blob download -c $container_name -n $blob_name -f file_location_tosave
#Listing the files under that storage account
az storage blob list -c $container_name
#Uploading file to blob storage in Azure from Ubuntu/Debian
az login
export AZURE_STORAGE_ACCOUNT=your-classic-storage-account--no_need_of_any_quotes
export AZURE_STORAGE_ACCESS_KEY=your-access-key--available-with-storage-account-onportal--no_need_of_any_quotes
export container_name=any-container-name
export blob_name=any_filename_that_you_wish_to_keep_for_uploaded_file
echo "uploading the file"
az storage blob upload -f file_complete_path -c $container_name -n $blog_name
echo "downloading the file"
az storage blob download -c $container_name -n $blob_name -f file_location_tosave
#Listing the files under that storage account
az storage blob list -c $container_name
Kitchen basic commands
> kitchen create (uses the .kitchen.yml file to initiate process)
> kitchen login (will login to the machine that created)
> kitchen converge ( to apply recipes)
> kitchen destroy ( will remove the VM)
Logging into Azure Classic from Powershell
Commands to run on poweshell:
Get-AzurePublishSettingsFile
Import-AzurePublishSettingsFile C:\pathoffile...
Example:
Get-AzureVM -Name vmname
Connecting to Azure from Ubuntu
After Installing Azure CLI (Steps on installing Azure CLI previously posted)
On Terminal
# Verifying
az --version
#Logging into Azure
az login
#To see tenants details
az account show
On Terminal
# Verifying
az --version
#Logging into Azure
az login
#To see tenants details
az account show
Install Python in Ubuntu
Ubuntu 15 or 16
sudo apt-get update && sudo apt-get install -y libssl-dev libffi-dev python-dev build-essential
Ubuntu 12 or 14
sudo apt-get update && sudo apt-get install -y libssl-dev libffi-dev python-dev
sudo apt-get update && sudo apt-get install -y libssl-dev libffi-dev python-dev build-essential
Ubuntu 12 or 14
sudo apt-get update && sudo apt-get install -y libssl-dev libffi-dev python-dev
Installing Azure CLI on Debian/Ubuntu versions
#For 32 bit Debian/Ubuntu Versions
echo "deb https://packages.microsoft.com/repos/azure-cli/ wheezy main" | \
sudo tee /etc/apt/sources.list.d/azure-cli.list
#For 64 bit Debian/Ubuntu versions
echo "deb [arch=amd64] https:packages.microsoft.com/repos/azure-cli/ wheezy main" | \
sudo tee /etc/apt/sources.list.d/azure-cli.list
sudo apt-key adv --keyserver packages.microsoft.com --recv-keys 417A0893
sudo apt-get install apt-transport-https
sudo apt-get update && sudo apt-get install azure-cli
if got error run one more time
sudo apt-get update && sudo apt-get install azure-cli
echo "deb https://packages.microsoft.com/repos/azure-cli/ wheezy main" | \
sudo tee /etc/apt/sources.list.d/azure-cli.list
#For 64 bit Debian/Ubuntu versions
echo "deb [arch=amd64] https:packages.microsoft.com/repos/azure-cli/ wheezy main" | \
sudo tee /etc/apt/sources.list.d/azure-cli.list
sudo apt-key adv --keyserver packages.microsoft.com --recv-keys 417A0893
sudo apt-get install apt-transport-https
sudo apt-get update && sudo apt-get install azure-cli
if got error run one more time
sudo apt-get update && sudo apt-get install azure-cli
Cassandra Keyspaces Query
CQLSH query for knowing keyspaces in Cassandra
> select * from system.schema_keyspaces;
or
> desc keyspaces;
> select * from system.schema_keyspaces;
or
> desc keyspaces;
Cassandra Version Query
CQL query for knowing Version of Cassandra
> select release_version from system.local;
or
> show version
> select release_version from system.local;
or
> show version
Storage account associated with VM in Azure
$disk = Get-AzureDisk | Where-Object { $_.AttachedTo.RoleName -eq "vmname" }
$mediaLink = $disk.MediaLink
$storageAccountName = $mediaLink.Host.Split('.')[0]
$storageAccountName
$mediaLink = $disk.MediaLink
$storageAccountName = $mediaLink.Host.Split('.')[0]
$storageAccountName
Running same command on multiple nodes
sshpass -p 'password' ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null username@hostname.com -C "command"
Installing Java 8 in Ubuntu
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get -y update
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
echo debconf share/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections
sudo apt-get -y install oracle-java8-installer
sudo apt-get -y update
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
echo debconf share/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections
sudo apt-get -y install oracle-java8-installer
Subscribe to:
Comments (Atom)