October 30, 2014

Mass insertion on Redis

No comments:
You may want to insert a lot of data into Redis. This would be easier to insert a lot data into Redis using Linux commands. Lets say we have a comma separated values in a file.

data.csv:
key1,1200
key2,5000
key35,12345
key12,4500

With following command you can load all the data into Redis. But you should start Redis server first.

cat data.csv | awk -F',' '{print " SET \""$1"\" \""$2 "\"\n"}'| /opt/redis-2.8.17/src/redis-cli --pipe

You can change data.csv as you want and according to your file.

October 22, 2014

How to build Redis server on Ubuntu 14.04

No comments:
Recently we used Redis server on Ubuntu 14.04. And I just thought about writing a blog post to show how to build Redis on Ubuntu server or desktop editions. 

First of all you have to go to Redis site and download the redis source code. Redis site

Copy the download link from redis site. Currently download link looks like this "http://download.redis.io/releases/redis-2.8.17.tar.gz". It may change depending on the version you want to download.

Then connect to the server through SSH or take a terminal on Ubuntu desktop machine. Run below command

wget <URL that you copied from redis site>

Then you want to install build-essential and  libjemalloc-dev in order to build redis server. To install those packages run below command.

sudo apt-get update && sudo apt-get install buid-essential libjemalloc-dev

After installing dependencies and tool you want to extract redis archive. Run below commands to extract it. Change the archive name depending on your download.

tar xvf redis-2.X.XX.tar.gz
cd redis-2.X.XX

To build redis server type below command on the terminal. It may take a while to build Redis.

make

If it didn't throw any errors, Congrats! You just build your own Redis server. Then if you want to run Redis server run below command. Make sure that you are in Redis folder.

./src/redis-server

 Then you can test redis server using redis-cli tool like below.

dedunu@test5:~/redis-2.8.17$ src/redis-cli
127.0.0.1:6379>
127.0.0.1:6379> set key1 value1
OK
127.0.0.1:6379> set key2 value15
OK
127.0.0.1:6379> get key1
"value1"
127.0.0.1:6379> get key2
"value15"
127.0.0.1:6379> 

If you get an output like above your redis works fine!

August 06, 2014

Disable telnet and enable ssh on Cisco Switch (IOS)

No comments:
We recently purchased a Cisco switch for our Hadoop cluster. So I wanted to setup Cisco switch. But first of all I want to configure ssh and disable telnet. Lets see how we can do that.
Connect to the switch using telnet or using console port. (You should enable telnet and give a password from express setup.)
enable
configure terminal
hostname <switchname>
ip domain-name <domain name>
crypto key generate rsa
Enter "1024" when it prompts for
How many bits int the modulus [512]:
Then run below commands
interface fa0/0
ip address 192.168.1.1 255.255.255.0
no shutdown
username <username> priv 15 secret <password>
aaa new-model
enable secret <password>
If you have a Cisco router use "0 4" instead of "0 14"
line vty 0 14
transport input ssh
end
copy running-config startup-config
Now you can use SSH client to connect to switch.

July 07, 2014

Ubuntu 14.04 Desktop - How I feel it

1 comment:
I couldn't install Ubuntu 14.04 as soon as it was released. But I upgraded my office laptop to Ubuntu 14.04 in June.

Ubuntu 14.04 is more stable than other releases. And Ubuntu 14.04 is a LTS (Long term support) version which will release updates till 2019. I switched to 14.04 from 12.04.

They have disabled workspaces. (+1) I hate this workspace business because it is very hard to work with windows when these workspaces are there. In Ubuntu 14.04, workspaces are disabled by default. You have to enable it if you want it. 

Now Ubuntu supports real time windows resizing. (Not that impressive. But nice to have.)  

I don't like Amazon plug-in in Unity dashboard. So I always run fixubuntu.com script to disable it.

wget -q -O - https://fixubuntu.com/fixubuntu.sh | bash

What you have to do is just run above command line on terminal. After doing that you wont see advertisements on your Unity dashboard.


I don't see super fantastic awesome features to celebrate on this release. But developers have done a good job it making Ubuntu more robust and stable. Multi-monitor user experience has been improved. 

They have changed lock screen. (+1) I like this lock screen more than older one. This lock screen is visually similar to the login screen.