Friday, August 21, 2015

Backup and Restore ElasticSearch Indices

This instructions are very basic and intended for someone who is new to ElasticSearch.

To backup and restore elasticsearch data follow these steps:

Source Server:
1.       In source server, ensure the path.repo is configured in the elasticsearch.yml (found in elasticsearch-<version>\config folder)
Example: Add this line at the end of elasticsearch.yml
path.repo: [ "C:\\ESBkup" ]
NOTE: This can be a network path too.
2.       Create the repository
Example:
PUT _snapshot/mybackup
{
  "type": "fs",
  "settings": {
      "location": "/ESBkup/mybackup"
    }
}
        NOTE: The path starts from the ESBkup
3.       Create the snapshot
PUT _snapshot/mybackup/snapshot_1?wait_for_completion=true
4.       Now you can open and see the C:\ESBkup folder and notice all the indices are backed up. You can copy the entire ESB folder to the target server.

Target Server:
1.       In target server, ensure the path.repo is configured in the elasticsearch.yml  as above. The path should be the same folder where you have copied the snapshot files from source server.
2.       Create the repository as above.
3.       Example:
PUT _snapshot/mybackup
{
  "type": "fs",
  "settings": {
      "location": "mybackup"
    }
}
                NOTE: the location is the direct snapshot folder and its not starting from the root folder (ESB).
4.       Now you can query the snapshot to find out what indices it has:
GET _snapshot/mybackup/_all
5.       To restore backup
POST /_snapshot/mybackup/snapshot_1/_restore?wait_for_completion=true
{
  "indices": "indexA,indexB,indexC"
}
                NOTE: you can use the indices to selectively restore indices


There are far more capabilities in ElasticSearch such as asynchronously triggering and monitoring snapshot backup etc. Refer to ElasticSearch documentation for more details.  

Technical Debt

Technical Debt is an interesting metaphor. Its been around now almost 25 years. This word was originally coined by the programmar Ward Cunningham who is also the one who developed the wiki software. His explanation of Technical debt is:

"Shipping first time code is like going into debt. A little debt speeds development so long as it is paid back promptly with a rewrite... The danger occurs when the debt is not repaid. Every minute spent on not-quite-right code counts as interest on that debt. Entire engineering organizations can be brought to a stand-still under the debt load of an unconsolidated implementation" 

Here is a video of Ward Cunningham discussing about this:


All technical debt is not bad. To some extent, incurring some technical debt speeds up the software development process.

Here is another interesting write-up by Martin Fowler on Technical debt

Sunday, August 16, 2015

Make your Google+ interesting!

The concept of social networking, in my opinion is, to build network between people who otherwise wouldn't have had a chance to connect to. That is, for example following up celebrities, news networks, connecting to people with special skills. In Twitter, we follow all these kind of people + our friends and relatives. This makes it interesting. However, Twitter is highly limiting (better after their recent changes). On the contrary, G+ has all the advantages of Twitter and in addition has awesome content capabilities and format.



Coming to the point, how to make your G+ experience more interesting? Don't worry or whine that your friends are not there. Its not going to work that way. Start following awesome google+ profiles.

Some of the G+ profiles I follow may interest you:


Most of these have huge following and frequent updates. I am sure this will make your G+ timeline more interesting. Do let me know your favorite plus profiles.