June 13, 2013

Do you want unlimited history in Linux Terminal?

History in Linux terminal is very usefull if you get used to it. If you have to ssh long hostname, or long  file paths you don't need to type them again and again. You can just grep your history and rip what you want like this.

Lets say I want my ssh commands I want to get.
history | grep ssh
perhaps may be smbclient commands
history | greb smbclient
By default in Ubuntu Linux History size is 2000 commands or some thing like that. That will limit you from accessing your all commands. Then you may feel sick of using history. Solution for that is making you linux terminal history unlimited. Those days disk space is not much concern so you can save your all the history in single file without any problem. For 7000 commands it will not take half of a Mega Byte at least. Lets see how to make this history unlimited.

1. Take a terminal and type below command.
gedit ~/.bashrc
or
vi ~/.bashrc
2. Then find  below lines from gedit or vi
HISTFILESIZE=2000 
HISTSIZE=2000 
3. Change delete the number infront of equal.
HISTFILESIZE= 
HISTSIZE=
4. Save it.
5. Close and open a terminal again.

June 11, 2013

Change default keyspace of Titan DB on Cassandra

Long time ago I have posted about how to use Titan with Cassandra. But it will only use a database called "titan". Sometimes you may want to use two different databases in Cassandra backend. In that case we have to use Cassandra Specific Configurations.


To change the database(I'm sorry I have used the word database instead of keyspace.), I'll change storage.keyspace. But this is not a modifiable setting. That means once you have used one value for a graph, you can't change it next time when you login. This is how they mention about it.

It is very important to note that some configuration options should NEVER be modified after the TitanGraph is first initialized. Doing so may corrupt the graph or lead to unexpected behavior.-- https://github.com/thinkaurelius/titan/wiki/Graph-Configuration
I'll give code how to connect to a Titan DB with different keyspace(database). First go to cassandra bin and run.
Linux:
bash cassandra

Windows:
cassandra.bat

Then take gremlin from titan bin.

Linux:
bash gremlin.sh
Windows:
gremlin.bat
Then you have to configure storage backend. for that use following commands on gremlin.
cnf = new BaseConfiguration();
cnf.setProperty('storage.backend','cassandra');
cnf.setProperty('storage.hostname','127.0.0.1');
cnf.setProperty('storage.keyspace','graph1');
g = TitanFactory.open(cnf);
 In this case I have used Cassandra Local host instance. And the keyspace that I'm going to use with graph database is "graph1". You don't need to get limited to one keyspace on one instance!

Those two links will help you if you are going to try Titan for the first time!
Enjoy Graphs!

What is this NoSQL?

Day by day NoSQL databases are releasing their new versions of their databases. But my favorite MongoDB has forgotten its purpose. And day by day the I find a limitation of NoSQL databases. Somehow NoSQL is not for everything. But in this way it seems like, it is not good for anything. I mean the MongoDB. Today I was reading about Security issues of MongoDB. But I couldn't find a problem in MongoDB. Because all those problems will come if we are going to use dynamic like queries or string JSON parsers.
I'm in a kind of a disappointment about NoSQL databases.