Support Engineer-Test Assignment
Support Engineer-Test Assignment
cnf for below specs linux server having huge DB transactions daily and receiving
Report hits n large data set:
RAM: 64GB
CPU: 8 Cores
HDD: 1TB
Below are recommended configuration for my.cnf against the above mentioned specs
innodb_buffer_pool_size = 45G -- about 70% of RAM
innodb_buffer_pool_size_instances = 16
innodb_file_per_table = ON
innodb_log_buffer_size = 64M
innodb_log_file_size = 2G
innodb_thread_concurrency = 28
innodb_stats_on_metadata = 0
query_cache_type = 0
query_cache_size = 0
Q2: Write a shell/bash DB backup script following below requirements:
Pre Requisites:
- There are 3 DBs, db01, db02, db02.
- DB Tables:
db01 : tbl01, tbl02, tbl03, tbl04
db02 : tbl05, tbl06, tbl07, tbl08
db03 : tbl09, tbl10, tbl11
Requirements:
- Backup should be an SQL dump
- Individual table dump should be taken
- Daily date wise directory should be created and daily dump should be placed in this directory.
- Dump should be zipped after dump is completed
#!/bin/bash
mysqldump="C:\xampp\mysql\bin\mysqldump.exe"
dbhost="localhost"
dbuser="root"
dbpass=""
folderName="$(date +"%d-%m-%Y")"
if [ -d "$folderName" ]; then rm -Rf $folderName; fi
mkdir "$folderName"
cd "$folderName"
# below lines can be automated using the for loop and index variable because of simple db and
tables names
$mysqldump -h $dbhost -u $dbuser --password="$dbpass" db01 tbl01 > db01_tbl01.sql
$mysqldump -h $dbhost -u $dbuser --password="$dbpass" db01 tbl02 > db01_tbl02.sql
$mysqldump -h $dbhost -u $dbuser --password="$dbpass" db01 tbl03 > db01_tbl03.sql
$mysqldump -h $dbhost -u $dbuser --password="$dbpass" db01 tbl04 > db01_tbl04.sql
$mysqldump -h $dbhost -u $dbuser --password="$dbpass" db02 tbl05 > db02_tbl05.sql
$mysqldump -h $dbhost -u $dbuser --password="$dbpass" db02 tbl06 > db02_tbl06.sql
$mysqldump -h $dbhost -u $dbuser --password="$dbpass" db02 tbl07 > db02_tbl07.sql
$mysqldump -h $dbhost -u $dbuser --password="$dbpass" db02 tbl08 > db02_tbl08.sql
$mysqldump -h $dbhost -u $dbuser --password="$dbpass" db03 tbl09 > db03_tbl09.sql
$mysqldump -h $dbhost -u $dbuser --password="$dbpass" db03 tbl10 > db03_tbl10.sql
$mysqldump -h $dbhost -u $dbuser --password="$dbpass" db03 tbl11 > db03_tbl11.sql
cd ..
# for linux
# zip -r "$folderName.zip" "$folderName"
# for cross platform
jar -cfM "$folderName.zip" "$folderName"
Q3: Write a shell/bash script to sync two folders on different servers. The script will run after every 10
minutes in crontab. Write crontab entry as well. Print logs with current date time at the start and end of
script.
SSH access verified between the two machines, you can sync the dir1 folder from earlier to a remote
computer by using this syntax
rsync -a ~/dir1 username@remote_host:destination_directory