Wednesday, June 30, 2021

Executing scripts on remote servers with ShellScript

Create a file with list of servers. 
Here in this example, created file "list_of_servers.txt" file containing list of servers IP/Hostnames.

#!/bin/bash
cnt=1
for each_server in $(cat list_of_servers.txt)
do
	echo "$cnt. working on ${each_server}"
	scp file_to_copy.sh user@${each_server}:/tmp
	ssh user@${each_server} "sh /tmp/file_to_copy.sh"
done

***

Monday, June 14, 2021

Changing TombStoneFailureThreshold on live Cassandra Cluster nodes

Changing TombStoneFailureThreshold on live Cassandra Cluster

jmxsh command to get and set TombstoneFailureThreshold live to avoid a node restart by setting it via cassandra.yaml

$ jmx_set -m org.apache.cassandra.db:type=StorageService TombstoneFailureThreshold 500
$ jmx_get -m org.apache.cassandra.db:type=StorageService TombstoneFailureThreshold Value

Copying data to and from in Cassandra with 'COPY' command having 'timestamp' column

Issues: Using simple COPY command with out passing datatimeformat will cause wrong number of records.

Command: Use COPY command by passing datetimeformat

COPY table_name TO '/path/to/save/file.csv' with DATETIMEFORMAT = '%Y-%m-%d %H:%M:%S.%f%z';

Note: The timestamp uses strftime format.

***