Downgrade OpenSSH on mac osx

openssh downgrade

To downgrade OpenSSH on a Mac, you must uninstall the current version of OpenSSH. You can do this by running the following command in a terminal:

sudo launchctl stop com.openssh.sshd
sudo launchctl unload -w /System/Library/LaunchDaemons/ssh.plist

Next, you will need to download the older version of OpenSSH that you want to install. You can do this by finding the version you want on the OpenSSH website or by using a package manager like Homebrew to search for the version you want.

Once you have downloaded the older version of OpenSSH, you can install it by running the following commands in a terminal. Let’s assume we will install openssh8.6p1.

tar xvzf openssh-8.6p1.tar.gz
cd openssh-8.6p1
sudo make install

Replace <8.6p1> with the version number of the OpenSSH release that you downloaded. This will install the older version of OpenSSH on your Mac.

Once the installation is complete, you can check the version of OpenSSH that is installed by running the following command:

ssh -V

This should print the version of OpenSSH that is installed on your system.

Note that downgrading software can sometimes cause problems, so it’s generally a good idea to back up your system before attempting to downgrade any software.

I hope this helps! Let me know if you have any other questions.

Common Gmail filters

gmail filters

Search mails for all Meeting/calendar related messages inside inbox
invite.ics in:inbox

Search mails for all Meeting/calendar related messages without Replies or Forwards
invite.ics -subject:”re:||Fwd:”

Search emails larger than 10MB

Search emails older than 2 years
(use “m” for months and “d” for days)

Search emails in the last 30 days or newer than 1 month|
(use “m” for months and “d” for days)

Search a word exactly matches the result:
use a plus sign like +universe
If you want to search emails with a word exactly matching universe. Try searching +universe. You will not get results for “universes” or “universal“.

A detailed list of Gmail filters is available here

Sequel Pro keyboard shortcut change

Sequel Pro

Sequel Pro is a fast, easy-to-use database Client for working with MySQL databases. It has a lot of other features you can explore more on the Website.

Keyboard Shortcut

Sequel Pro by default doesn’t provide a feature to change a KeyMapping. However, changing keyboard shortcuts in Sequel Pro is very much possible in Mac. My major use case is to “Save Query” & I use it a lot. I generally create separate files for different Databases. I am used to Command+S(⌘+S) to save the ongoing work but that doesn’t work for Sequel Pro by default.

But it’s not supported by Sequel Pro directly, but we have a workaround for the same. Here we go:

  • In Mac, we can add shortcuts via System Preferences for an Application.
  • Go to Keyboard > Shortcuts > Application Shortcuts.
  • Now click the “+” button and a window will open with options to select/add Application, Menu Title & Keyboard Shortcut.
  • Select “Sequel Pro” in Application and enter “Save Query” as the Menu Title and assign “cmd+S”.

Sequel Pro shortcut for save query

  • Similarly, then add “Save Connection” and assign “ctrl+cmd+S” – both shortcuts will get swapped.

Once you are done it will look like the below screenshot.

Sequel Pro keyboard shortcuts

Similarly, you can add more shortcuts for Sequel Pro and for other Applications as well.

By single command on Terminal

You can also use the below command in Terminal to create both of the shortcuts. We can check the settings by executing $ defaults read com.sequelpro.SequelPro

defaults write com.sequelpro.SequelPro NSUserKeyEquivalents '{
    "Save Connection" = "@^s";
    "Save Query" = "@s";



Redis 3.0.0 stable is released

Redis 3.0.0

On April 1st Redis team announced the release of Redis 3.0.0 stable. It is the firs stable version of Redis with native support for clustering. Team was working on this from long and many of the features were already back ported to Redis 2.8.

Major Changes

Other new things implemented in 3.0.0 that may be significative to
users not interested in Redis Cluster are:

  • An improved LRU algorithm, ways more precise to evict the older keys.
  • Redis 3.0.0 is generally sensibly faster under high (pipelined) load.
  • AOF rewrite was reworked in order to reduce latency spikes with slow disks when the process undertakes the final “write” of the accumulated buffer.

Changes compared to Redis 2.8?

  • Redis Cluster: a distributed implementation of a subset of Redis.
  • New “embedded string” object encoding resulting in less cache misses. Big speed gain under certain work loads.
  • AOF child -> parent final data transmission to minimise latency due to “last write” during AOF rewrites.
  • Much improved LRU approximation algorithm for keys eviction.
  • WAIT command to block waiting for a write to be transmitted to the specified number of slaves.
  • MIGRATE connection caching. Much faster keys migraitons.
  • MIGRATE new options COPY and REPLACE.
  • CLIENT PAUSE command: stop processing client requests for a specified amount of time.
  • BITCOUNT performance improvements. * CONFIG SET accepts memory values in different units (for example you can use “CONFIG SET maxmemory 1gb”).
  • Redis log format slightly changed reporting in each line the role of the instance (master/slave) or if it’s a saving child log.
  • INCR performance improvements.

Redis Sentinel or High Availability of Redis

Redis Sentinel:

Redis Sentinel is designed to monitor Redis Instance. It can automatically switch your master if it goes down or having some issue. Hence it will reduce the time for manual issue identification and switch. That will give us high availability,  that is why some people call it HA for Redis.

As per Redis team Sentinel does 4 things: Monitoring, Notification, Configuration Provider and Automatic failover. Redis Sentinel is used to monitor Redis Master Slave setup. If Redis Sentinel find a master is not working as expected then it starts a failover process, where it promotes the slave to master. In nutshell you can say Redis Sentinel will switch the master. All the other slaves are reconfigured or updated to use new master, by communicating new config. Application using Redis server is also updated about new configurations. We can also use Sentinel as service discovery, client can directly connect with Sentinel and ask for current master address. It will return new address in case of fail-over.

Redis Sentinel Distributed Nature:

Redis Sentinels are distributed in nature and following conditions are true for Redis Sentinel.

•    A cluster of Sentinel can failover a master even if some Sentinel are failing.
•    A single Sentinel not working well, or not well connected, can’t failover a master without authorization from other Sentinel.
•    Clients can connect to any random Sentinel to fetch the configuration of a master.


You may get confused between Redis, Redis Server and Redis Sentinel. Redis Sentinel is packed in Redis 2.8, so Redis Sentinel is not a separate software or package. For clarity i am defining the terms used…

Redis2.8 refers to Redis package only. It contains Redis Server as well as Redis Sentinel.

Redis Server or Redis Master Slave means machine having some Redis package running Redis Servers.

Redis Sentinel Or Sentinel refers to Sentinel and is part of Redis package(majorly Redis 2.8).

Current Version of Redis Sentinel

“Sentinel 2”, is latest version as of today. Redis Sentinel 2 is shipped in Redis 2.8(latest version of Redis as of today).  “Sentinel 1” is buggy and advised not to used. That doesn’t mean you can’t use new “Sentinel 2” with Redis 2.6 Server or below.  You can install Redis 2.8 on Sentinel machines and let them monitor your Redis 2.6 server. But it will be good if you can migrate all your Redis Servers to Redis 2.8. Summary: Use Redis 2.8 to run Sentinel.

How to Run Redis Sentinel?

Redis Sentinel are very easy to setup. Here i assume that that you already have Redis Master Slave setup. if not, you can read here.

Redis Sentinel Config

Redis package have a file called sentinel.conf that contains documentation with examples. You can delete all the content of sentinel.conf and add below lines to it.

port 26379
pidfile /var/run/redis/
logfile /var/log/redis/redis-sentinel.log
daemonize yes
loglevel notice
dir /tmp

sentinel monitor MYMASTER 6379 2
sentinel auth-pass MYMASTER abc123
sentinel down-after-milliseconds MYMASTER 1000
sentinel parallel-syncs MYMASTER 1
sentinel failover-timeout MYMASTER 180000

First 6 lines of sentinel conf file are self explanatory and defines the configs of Sentinel daemon. We will explain other lines one by one below:

  • First line “sentinel monitor” tells Sentinel to monitor a master and name it “MYMASTER”(name doesn’t matter). It have the address “” and port “6379”, with quorum 2. Quorom 2 means Sentinel can start a failover only if at-least 2 Sentinel fails. In nutshell, “start failover, if more than two Redis Sentinel has detected that master is failed”.
  • Second line defines the password of Redis instance “MYMASTER”, here we are assuming it as “abc123” .
  • Third “down-after-milliseconds” is the time after which if an instance is not reachable (does not reply to the PINGs or reply with an error)  from a Sentinel. Then it can start thinking it is down. Sentinel will mark this instance as down and communicate to others. If other Sentinel says same and count of Sentinel is equal or more than Quorom defined in first line and it can start the failover process.
  • Fourth “parallel-syncs”,  number of slaves that be reconfigured as master.
  • Last “failover-timeout” is the wait time to fail same master again.

If you noticed we only defined the master address in config file. Here the Sentinel will fetch the slave data from master machine itself.

Start Redis Sentinel:

redis-sentinel /path/to/sentinel.conf


redis-server /path/to/sentinel.conf --sentinel

Any of the above methods will work, but sentinel.conf is mandatory otherwise it will through an error. By default, Sentinel runs on the 26379 port but you can change it in the config file.

Now you need to do the same thing on 2 more machines, which will end up a cluster of 3 nodes. All the Sentinel will coordinate with each other automatically. You don’t need to define the communication between them. Make sure the ports are open for communication.

Important Setting:

If you are using a password in the Redis Master slave setup, don’t forget to define “masterauth” variable in “redis.conf” of both master and slave. When your down master will come up again, this is required. Otherwise, your old master(down master) will not be able to connect with the new master.

masterauth abc123

Check Redis Sentinels logs you get more idea, how it works:

Redis Sentinel Instance logs

In the Above image Redis Sentinels version 2.8.17 is running on port 26379 with PID 22649. Sentinel is monitoring Redis master running on The last line says another instance of Sentinel is up and running on port

Redis Sentinel Logs for second instance

Logs of the Second instance are exactly similar to as explained above.

For more details read the Redis sentinel document:

Redis master slave setup on single machine

What is Redis Master Slave?

Redis Master Slave setup is same as any other Master Slave setup. It allows you to maintain multiple copies of same data automatically. That will serve the purpose of backup and scaling. You can use Redis Slave to serve the request the reading requests and hence your master load decreases.

We will start with installation of Redis Server, then Redis Slave and then will setup Redis Mater Slave replication.

About Redis:

Redis is an open source, BSD licensed, advanced key-value cache and store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, sorted sets, bitmaps and hyperloglogs.

Many languages have Redis bindings, including: ActionScript, C, C++, C#, Clojure, Common Lisp, Dart, Erlang, Go, Haskell, Haxe, Io, Java, JavaScript (Node.js), Lua, Objective-C, Perl, PHP, Pure Data, Python, R, Ruby, Scala, Smalltalk and Tcl.

Install Redis

There are too many ways to install Redis, we will discuss two ways:

  1. One from source code that works for most of Unix based Operating system and Mac OS X.
  2. Another using apt package manager(that works on Debian/Ubuntu systems).

If you want to run both Master Slave on same machine and not familiar with Unix Systems; better to do that setup with source code(method1).

Install Redis by Method1(through source code):

Open Shell/Terminal/Command Prompt:
wget ''
tar xzf redis-2.8.19.tar.gz
cd redis-2.8.19

‘make’ will take few seconds or up to 1-2 minutes to finish and your Redis is installed

Start Redis Command
src/redis-server &
Lets Verify it:
src/redis-cli> set foo bar
OK> get foo

By default Redis runs on port 6379, you can change it very easily from redis.conf file.

Install Redis by Method2 (using apt package manager):

Open Shell/Terminal/Command Prompt:
sudo apt-get update
sudo apt-get install redis-server

Your installation is done and it will start automatically, lets check…

Lets Verify it:
redis> set foo bar
redis> get foo

Till this point single instance of Redis is running fine, if you face any issue, please comment below with error message. Next thing is to run Redis in Master Slave mode. It means we will run two instances of Redis. Here we will run both the instances on same machine. But on production you should install it on different machines, otherwise it will not be HA.

Stop Redis

Config changes to convert Redis instance to Redis Master:

Now we will change in config file to run mater slave. Steps are very simple and config properties are self explanatory.

vi redis.conf
sudo vi /etc/redis/redis.conf
Change Listening Interface:

By default Redis listens for connections from all the network interfaces available on the server. It is possible to listen to just one or multiple interfaces using the “bind” configuration directive, followed by one or more IP addresses. like bind If the bind option is not specified all the interfaces will listen for incoming connections.

Lets comment it, if not.

# bind 
Set Master password:

We should use redis with password authentication, to make redis connection secure. But it will solved one more issue. Without password sentinels works like charm. But with password authentication in Redis most of the people do same mistake. That is why we are taking password approach, you can skip this step if you don’t want to use Redis with password.

# requirepass foobared
requirepass abc123

Config changes to setup Redis Slave:

copy redis.conf to slave.conf if you want to run master and slave on same machine. Otherwise just use redis.conf on other machine and do the above two steps again on new machine conf file.

cp redis.conf slave.conf
vi slave.conf
Change slave port

Also change the port if both the master and slave are running on same machine. You can’t run two instances with same port in single machine.

#port 6379
port 6380
Declare the Master Details:

In slave.conf file set master host and port details, so that master slave can communicate. If on different machine add master machine IP address.

# slaveof <masterip> <masterport>
slaveof 6379
Master password in slave:

Set password that is required by Slave to connect to Master Redis server. Means the password we set earlier for master.

# masterauth <master-password>
masterauth abc123

Lets Start the Redis Master Slave

src/redis-server redis.conf
src/redis-server slave.conf
/usr/bin/redis-server /etc/redis/redis.conf
/usr/bin/redis-server /etc/redis/slave.conf
 Now we will test the Redis master slave setup on shell
redis-cli -p 6379 abc123> keys *
(empty list or set)> set foo bar
OK> get foo
"bar"> quit
Now check same on Redis Slave
redis-cli -p 6380 -a abc123> keys *
1) "foo"> get foo

Setup of Redis master slave is done, if you want to run one more slave, just repeat the steps after we copied the  redis.conf to slave.conf.