Google Cloud SQL

Cloud SQL is service for relational database in google cloud platform and fully manage by Google. Cloud SQL support mysql 5.6 (will be deprecete on march 2020), PostgreSql and Sql server. CloudSQl ensures your instance for the database is updated, patch, and backup. GCP provide  SLA 99,5% for this servece. You can chose variant from MySql 5.6-5.7 or PgSql 9.6-11 or SQL Server 2017 (Beta).
Create CloudSql

Since the isntance is managed by Google, you don’t need too worry about backup, ha or replication configuration. All in one click in the Gcloud console interface. Thi service also provide setup to migratio your database from your premisess as master to the Cloud SQL as the slave.

Unfortunally if the replication on the Cloud SQL is using GTID. So you can’t use any database with view or temporary table on your database in order to make the replication work. You can use it in single instance only if you have those kind of tables.

Thank You.

Back-up is not important!

As a system administrator who have a system or server that needs to run all the time, we need to have a backup at least once a week. This backup can be in file level, such as rsnapshot in Linux. Or can be VM level backup such as the vzdump in the Proxmox environment.

The backup always comes handy if something goes wrong in the current production environments. Let say, costumer accidentally delete the Nginx configuration. We can restore from the rsnapshot daily backup. Or, VM accidentally destroyed from hypervisor Proxmox. We can restore it from the vzdump backup.

But, sometimes users or customers does not fully aware or even notice the importance of the backup. Usually, they become angry and reactive when the issues happen even though we have offered the backup solution when the project started.

If we look closely, it’s true that the backup actually not important. Why? it’s is obvious that when everything is okay this backup only a junk of file without purpose. This especially happens with sensitive budget type customers or users. I also can relate to this point of view.

By stating “Backup Is not Important”, what I am trying to say is that backup is only a bunch of files unless you can make sure that the file is usable or able to perform as the initial state when the restore procedure is done. So it is important to make sure that you have at least procedure to test restoring your backup files and make sure that the system is working as intended.

Migrate your Linux Server using Rsync

Sometimes we need to move our server to another. Either it’s from on-prem to cloud, vm to vm, or to vps. While migrating we want minimum downtime as we can to the service or systems. Usually, i use rsync to migrate the data and even the OS, so we don’t need to reconfigure the server on the new DC or environment.

To perform that you need to;

  1. Make sure you set up the target VM/server the same as the source.
  2. Setup ssh keyless for root either from or to the target server. You can use rsync to push or pull the data from or to the servers.
  3. Perform rsync dryrun to test your migration. Also, make sure to exclude the specific configuration for the host to avoid conflict or error when you transfer the data. Example;
    rsync -aHAXPn –numeric-ids –exclude={“/boot/*”,”/etc/default/grub”,”/etc/fstab”,”/etc/lvm/*”,”/etc/udev/*”,”/etc/ssh/*”,”/etc/network/interfaces”,”/root/.ssh/*”,”/etc/hostname”,”/etc/hosts”,”/dev/*”,”/proc/*”,”/sys/*”,”/tmp/*”,”/run/*”,”/mnt/*”,”/media/*”,”/lost+found”} old.hostname:/ /
    -n : dry-run
    -another option : please reffer to manual 😛
    * You need to adjust the excluded files based on your OS distribution
    * In this case, we pull the data from the old server to new server.
  4. Perform the initial sync by removing the “-n” from the command above.
  5. For final migration, stop all service on the source server to keep data consistency and avoid data corruption. Then perform step number 4 again.
  6. Now you can try to restart your VM in the new environment or DC. The server supposed to boot normally unless you’ve done something wrong.

Hope this helps you.
Thank You.

My MegaRaid CheatSheat

This is my most used MegaRaid command collection.

A fast command to diagnose the array health status;
MegaCli64 -pdList -a0 | grep -i -E “enclosure|slot|RAW Size|device id|pd type|firmware state|inquiry data”

List the phisical disk;
MegaCli64 -pdList -a0 | grep -i -E “slot|RAW Size|pd type”

List logical drive;
MegaCli64 -LDInfo -Lall -aALL

Locate and blinking your disk in the controler
Start blinking
MegaCli64 -PdLocate -start -physdrv[<ENCLOSURE>:<DRIVE>] -a0
Stop blinking
MegaCli64 -PdLocate -stop -physdrv[<ENCLOSURE><DRIVE>] -a0

To be Continue..

Passing LFCS Exam

On November 28 I am taking the Linux Foundation Certified Linux System administrator exam for the second time. The first one is failed with only 47% point form 66% required to pass. This is a late exam actually, I bought this form cyber Monday discount last year. Fortunately, on the free retake, I am able to pass with an 85% point.
The first take feels like taking a grasp of what all of the performance-based on hands exam looks like. This exam is performed online with a proctor. All the activity during the exam is recorded and shared via the sharing screen by the examschool.local plugin installed as mandatory to take the exam. You will not allow covering your mouth, mouthing, and any suspicious activity during the exam. You are allowed to bring water with a clear glass cup. The exam time is 2 hours with 24 tasks. You can take a break to the restroom but the time will continue to roll.

On this exam the task is structured as:

  • Essential Commands – 25%
  • Operation of Running Systems – 20%
  • User and Group Management – 10%
  • Networking – 12%
  • Service Configuration – 20%
  • Storage Management – 13%

You will instruct to use command for user management, password, permission, access lists, changing the hostname, create lvm, software raid using mdadm, partitioning and grep some content or find files with certain criteria.

All the task is related to a daily administrative task. All the tasks can be achieved by using the manual of the command. I am using apropos to search the keyword for related command to find their man.