There was one situation, where our production mongo server suddenly becomes secondary, causing any write and read to the server to fail. Searching in the mongo documentation, we found an easy solution. Below are the steps.
First step:
Check that your replica is running fine
mongo> rs.status()
Second step:
Freeze all mongo node in the replica that you do not want to be primary for lets say, 120 seconds. Access the mongo shell, and run below command, do this for all nodes that you do not want to be primary
mongo> rs.freeze(120)
Third step:
Demote the current primary, so that other node that has not been frozen, will take over as primary. Run this in mongo shell, to demote the node from being a primary, for 120 seconds
mongo> rs.stepdown(120)
That's it, run rs.status() again to make sure that your desired server is now a primary.
Reference: https://docs.mongodb.com/manual/tutorial/force-member-to-be-primary/
Saturday, December 29, 2018
Force a mongodb in a replica set to be a primary
Tuesday, December 18, 2018
Use centos repository in RHEL
Get the repository url in your country, by visiting http://mirror-status.centos.org/. In my case, since I am in Malaysia, I chose http://centos.ipserverone.com/centos/
Create a repo file in /etc/yum.repos.d
# cat > /etc/yum.repos.d/centos.repo
[centos]
name=CentOS-7
baseurl=http://centos.ipserverone.com/centos/7/os/x86_64/
enabled=1
gpgcheck=1
gpgkey=http://centos.ipserverone.com/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7
Check whether your new centos repo is listed and ready to be used
# yum repolist
Backup RHEV/RHV/ovirt disk image to external drive
Login to RHV/RHEV/ovirt administrator interface
Tuesday, December 11, 2018
Send postgresql log to syslog
Enable syslog to listen to udp port 514 (the port number can be changed to suit your need)
Tuesday, December 4, 2018
Install nvidia driver for Tesla card on ubuntu 16.04
Check what driver your card is currently using, in this case, the card is using the opensource nvidia drivers called nouveau
$ lspci -v | grep -A8 NVIDIA
3d:00.0 3D controller: NVIDIA Corporation Device 1bb3 (rev a1)
Subsystem: NVIDIA Corporation Device 11d8
Flags: bus master, fast devsel, latency 0, IRQ 40
Memory at b7000000 (32-bit, non-prefetchable) [size=16M]
Memory at 4bfe0000000 (64-bit, prefetchable) [size=256M]
Memory at 4bff0000000 (64-bit, prefetchable) [size=32M]
Capabilities:
Kernel driver in use: nouveau
Kernel modules: nvidiafb, nouveau
Monday, December 3, 2018
Using tsocks with apt to bypass proxy
Recently, I encountered an error while trying to update ubuntu server 16.04. The error is as below: