Posts

Showing posts from May, 2016

Accessing Cassandra through NodeJS

Below are the steps to enable web access of Cassandra DB -------------------------------------------------------- 1. install Cassandra DB from apache cassandra 2. install nodejs 3. install the required modules    a) http       - npm install http    b) cassandra  - npm install cassandra-driver    c) express    - npm install express    d) body-parser - npm install bodyParser 4. create a nodejs file    E.g. myserver.js 5. now add following lines    a) first need to list the required modules       var express = require('express');       var bodyParser = require('body-parser');       var cassandra = require('cassandra-driver');       Note: Put actual path of the driver if not in current directory. E.g             'D:\\Node-modules\\express').  \\ is required    b) declare a cassandra client and connect to cluster       var client = new cassandra.client({contactPoints:['127.0.0.1']});       client.connect(function(err, resul

Creating web servers with Node JS

Install Node JS on CentOS 1) sudo curl --silent --location https://rpm.nodesource.com/setup_4.x | bash - 2) sudo yum install -y nodejs   (CentOS)      sudo apt-get install nodejs  (Ubuntu) Creating Web Server Node JS is ideal for creating scalable and lightweight web servers that can handle great number of simultaneous requests. Node JS is shipped with several core modules out of the box and the http module is used to create http server. Below are the steps to create a simple web server Create a file named server.js and add the following #require / import http module var http = require('http'); #define a port to listen to const port = 8080; #define a function for listening to requests and respond with response function handleRequest(request, response) {       response.end('Hello World!'+ request.url); } #create the server var server = http.createServer(httpRequest); #start the server server.listen(PORT, function()) {        #register call

Python install on CentOS

Pre Requsites 1. Check that the machine or VM running CentOS has ip address and internet connectivity 2. yum works - run sudo yum update -y 3. if ifconfig - command not found, then sudo yum -y install net-tools Install pip with Curl and Python 1. sudo  curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py" 2. sudo python get-pip.py Verify pip installation pip --help Verify Python installation python Python 2.7.5 (default, Nov 20 2015, 02:00:19)  [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> 

Cassandra install on CentOS

Pre Flight Check 1. Check that the machine or VM running CentOS has ip address and internet connectivity 2. yum works - run sudo yum update -y 3. if ifconfig - command not found, then sudo yum -y install net-tools 4. if locate - command not found, then sudo yum -y install mlocate Installation Steps 1.  Install Java  - sudo yum -y install java 2.  Add the Datastax community repository -               sudo vi /etc/repos.d/datastax.repo           Then add the below lines           [datastax]           name = Datastax Repo for Apache cassandra           baseurl = http://rpm.datastax.com/community           enabled=1           gpgcheck=0 3. Save the file 4. Install Cassandra -  sudo yum install -y dsc30  (for Cassandra 3.0)                                       sudo yum install -y dsc20 (for cassandra 2.0) 5. Start Cassandra   - sudo systemctl start cassandra 6.  Setup cassandra to start automatically at bootup  - sudo systemctl enable cassandra 7.  check cassandra

Comparing Puppet and Chef

Topic Chef Puppet Prerequisite Familiarity with Git and Ruby None Most suited for Development focussed teams If if stability and maturity are key factors   Ideal As a solutions for heterogenous environment As a solutions for heterogenous environment Price Free open source version Free open source Code driven Better control and flexibility over configurations Less control due to model driven approach Git Enables version control of configurations No Installation burden Use of knife tool Use of facter tool Learning curve Steep – Ruby and procedural code Steep - Ruby Simplicity Not simple tool –can lead to complications Not simple tool –can lead to complications Push functionality Not supported Not supported Language JSON like language and Ruby Subset of Ruby

Comparing different cloud providers

Feature Sub feature Openstack AWS Availability Regions NA Global Identity Keystone IAM Compute Compute EC2 Instance Instance Instance /VM Sizes Flavors. Variety of sizes Various sizes OS offered Any OS that is hosted on Openstack cloud AMIs provided by Amazon community / marketplace Images Images AMIs Image store Glance S3 Block storage Cinder Amazon EBS Networking Neutron Networking Assigning private IP to instances using DHCP Yes Yes Public IP address Floating IP Elastic IP Creating networks and networking functions Can be created Virtual routers or switches can be added if u use VPC DNS Domain names Designate Route 53 Device virtualization & Higher