How to install MongoDB on RHEL/Centos/Fedora Server

Introduction to MongoDB:-

MongoDB is an open source schema less database system which provides a document-oriented data model. The prime concern was that MySQL is written using SQL queries, while MongoDB is focused on BSON (Binary JSON). It is a cross-platform NoSQL database. It is table based relational database structure in favor of json like documents with dynamic schemas, making the integration of data in certain types of applications easier and faster. MongoDB is free and open-source software.

So let’s see the steps to install mongoDB on RHEL/Centos or Fedora Server.

How-to-install-MongoDB-on-RHELCentos-Fedora-Server

Installation procedure:-

Step: 1  System Login as root user. We are checking system OS type and system bit type.

 # uname –a
   # cat /etc/issue

Step: 2  Now we are creating a yum repo file .like /etc/yum.repos.d/mongodb.repo

# vi /etc/yum.repos.d/mongodb.repo

For we are using as 64 bit System:

[mongodb]
name=mongodb Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
enabled=1

For we are using as 32 bit System:

[mongodb]
name=mongodb Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686
gpgcheck=0
enabled=1

Step:3  Now we install MongoDB client and server using Yum

       # yum install mongo mongo-server

Step:4  Now we can configure and basic setting in MongoDB Database Server

       # vi /etc/mongod.conf
       logpath=/var/log/mongo/mongod.log
       port=27017
       dbpath=/var/lib/mongo

Step:5  Start MongoDB Server

       # /etc/init.d/mongod start

Step:6  Start MongoDB Server on system boot time

       # chkconfig mongod on

Step:7  Test MongoDB server

# mongo
   	> use test
   	switched to db test
  	> db.test.find()
 	> db.test.save({sd: 1})
	> db.test.find()
  	{ "_id" : ObjectId("4b9ef53c4f450969bb35a1a9"), "sd" : 1 }
   > db.test.update( {sd: 1}, {sd: 5})
   > db.test.find()
 	{ "_id" : ObjectId("4b9ef53c4f450969bb35a1a9"), "sd" : 5 }

 

Conclusion:-

MongoDB has an official driver for a variety of popular programming languages and development environments.

We at Andolasoft having vast expertise on implementing MongoDB database as backend in several cutting edge applications. We have developed many apps like OrangeGigs, SQUADZ  by using MongoDB as backend.

You can also see: How to Import csv configuration file to device’s SQLite db

Hope it will be helpful for you. I’d love to hear about your thoughts on this.
Thank you for your Interest.

How To Install Nagios Core on CentOS, Fedora, or RHEL Server

Nagios® Core™ is the industry standard Open Source system and network monitoring application which enables organizations to identify, resolve IT infrastructure problems before they affect critical business processes. It watches hosts and services that you specify, alerting you when things go bad and when they get better. Nagios Core serves as one of the foundation blocks of Nagios XI – commercial monitoring solution.

It was originally designed to run under Linux, although it should work under most other unices as well.

Steps to install :

STEP-1:

Install prerequisites packages

       #   yum  install  gd  gd-devel  httpd  php  gcc  glibc  glibc-common

STEP-2:

Disable selinux. open the file: /etc/selinux/config by issuing the following command          

       # vi /etc/selinux/config

Then, type “disable” opposite to “SELINUX” e.g  SELINUX= disable

STEP-3:

Create a user “nagios” and set password for it by typing the below commands.

       #   /usr/sbin/useradd -m nagios
       #   passwd nagios

STEP-4:

Create a new group “nagios” for allowing external commands to be submitted    through the web interface and add both the nagios user and the apache user to the group by following the below steps

       #    /usr/sbin/groupadd nagios
       #    /usr/sbin/usermod -a -G nagios nagios
       #    /usr/sbin/usermod -a -G nagios apache

STEP-5:

Create a directory “download “ and download nagios-core and plugins to it.

       #  mkdir download                  
       #  cd  download
       #  wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.4.4.tar.gz
       #  wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.16.tar.gz

STEP-6:

Compile and Install nagios-core package by following below steps

  • Change directory to “download” folder
       #   cd ~/download
  • Untar the nagios-core tar bal
       #   tar xzf nagios-3.4.4.tar.gz
  • Change the directory to “nagios-3.4.4”
       # cd nagios-3.4.4
  • Configure the package and install
    #  ./configure
    #   make all
    #   make install
    #   make install-init
    #   make install-commandmode
    #   make install-config
    #   make install-webconf

STEP-7:

Create a password to log in to the web interface by issuing the following command.

       # htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

STEP-8: 

Start the service and set it on chkconfig to start at booting time.

       #  service nagios start
       #  chkconfig nagios on

STEP-9:  

Compile and Install nagios-plugin package by following below steps.

  • Change directory to “download” folder
       # cd   ~/download
  • Untar nagios-plugin tar ball
       # tar xzf  nagios-plugins-1.4.16.tar.gz
  • Change the directory to “nagios-plugins-1.4.16”
       # cd  nagios-plugins-1.4.16
  • Configure the package and install.
       # ./configure
       # make
       # make install

STEP-10:

Start the apache service and enable it on boot by issuing following command.

       # service httpd start
       # chkconfig httpd on

STEP-11:  Now, connect to your nagios server through browser by typing.

       # http://Your-Nagios-IP/nagios or  http://localhost/nagios

Then, enter login credentials.
Username: nagiosadmin & password you have chosen earlier

Features of NAGIOS Core

  • Monitoring of network services (SMTP, POP3, HTTP, NNTP, PING, etc.)
  • Monitoring of host resources (processor load, disk usage, etc.)
  • Simple plugin design that allows users to easily develop their own service checks
  • Parallelized service checks
  • Ability to define network host hierarchy using “parent” hosts, allowing detection of and distinction between hosts that are down and those that are unreachable
  • Contact notifications when service or host problems occur and get resolved (via email, pager, or user-defined method)
  • Ability to define event handlers to be run during service or host events for proactive problem resolution
  • Automatic log file rotation
  • Support for implementing redundant monitoring hosts
  • Optional web interface for viewing current network status, notification and problem history, log file, etc.

Recommended Blog: How to install and configure Jaspersoft in Linux Server(RHEL/Centos/Fedora)

I hope you liked this topic, if you have any questions or comments please feel free to put under comments!

Configure Dropbox in RHEL/Centos/Fedora and File Upload From Linux To Dropbox

Dropbox is a free file hosting service operated by Dropbox, Inc. that lets you bring your photos, docs, and videos

dropbox2from anywhere and share them easily. Dropbox allows users to create a special folder on their computers, which Dropbox then synchronizes so that it appears to be the same folder (with the same contents) regardless of which computer is used to view it. Files placed in this folder also are accessible through a website and mobile phone applications.

Follow the below steps to configure Dropbox:

Step:1 Create an account on www.dropbox.com

Step:2 Login your Linux System

Step:3 we need to install dependency packages

# yum install curl bash

Step:4 Now go to /tmp directory and download dropbox up loader script and give appropriate permission to run script

test@localhost:~$ cd /tmp
test@localhost:~$ wget https://raw.github.com/andreafabrizi/DropboxUploader/master/dropbox_uploader.sh
test@localhost:~$ sudo cp dropbox_uploader.sh /usr/local/bin/droptobox
test@localhost:~$ sudo chmod +x /usr/local/bin/droptobox

Step:5 Now you can run the program anywhere from the terminal by running droptobox command

1
test:~$ droptobox

Here will ask you for the “App Key and App secret”,
Then create it from the Dropbox web and copy below url and paste in browser
# https://www.dropbox.com/developers/apps
Here we click “app” button and create an app. Give “Full Access” while filling the App details.
It will display an “App Key” and “App Secret” after successful creation.
Copy both App key and App Secret key and go to terminal and paste and give “f” in the access option.
# App key: xxxxxxxxxxxxxx
# App secret: xxxxxxxxxxxxxxx
# Access level you have chosen, App folder or Full Dropbox [a/f]: f
Then it will display a Link, Copy and paste it on the web browser and Allow the API access.

How to upload file from Linux terminal to dropbox:

Here we can use ” /usr/local/bin/droptobox ” or ” droptobox ”
## List Directory
# /usr/local/bin/droptobox list
## Upload a file to drop box
# droptobox upload file1
## Upload the files to your drop box /Test directory
# droptobox file1 Test/file1
## Delete a file “file1″ in “Test” directory in dropbox
# droptobox delete Test/file1
## Download a file “file1″ in “Test” directory in dropbox
# droptobox download Test/file1

See also : Andolasoft launches “Patia” – Free App to Find your file in Dropbox & Google Drive

Hope you liked the blog. It would be great if you can share your valuable comments with us.

Memcached Vs Redis, Which One to Pick for Large Web App?

Introduction:

MemcacheD is easy yet powerful. It’s manageable design promotes fast deployment, ease of exaggeration, and solves many problems related to large data caches. It has its inbuilt APIs which provide a very large hash table distributed across multiple machines & uses internal memory management which is more efficient in the simplest use cases because it consumes comparatively less memory for metadata. MemcacheD supports only String data type which are ideal for storing read-only data.

Memcached is a volatile in-memory key-value origin. It is rude, multi-threaded and used primarily for caching objects.

Redis is an open source in-memory data structure store which also can be used as a database as well as caching. It supports almost all types of data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes through radius queries. Redis also can be used for messaging system used as pub/sub.

Internal Architecture:

Internal Architecture

 

Here are the key points to consider,

Installation:

Installing Redis is so much easier. No dependencies required.

Memory Usage:

MemcacheD’s internal memory supervision, while not exactly a substitute to Redis; Is more efficient because it consumes comparatively less memory resources for metadata. For easy key-value pairs, MemcacheD is more memory efficient than Redis. Redis is more memory efficient, only after you use Redis hashes.

Persistence:

If you are using MemcacheD, data might be lost with a restart and rebuilding cache is a costly process. On the other hand, Redis can handle persistent data. By default it syncs data to the disk at least every 2 seconds, offering optional & tuneable data persistence meant to bootstrap the cache after a planned shutdown or an unintentional failure. While we tend to regard the data in caches as volatile and transient, persisting data to disk can be quite valuable in caching scenarios.

Replication:

MemcacheD does not support replication, whereas Redis supports master-slave replication. It allows slave Redis servers to be the exact copies of master servers. Data from any Redis server can replicate to any number of slaves. Replication can be used for implementing a cache setup that can withstand failures and find the maintenance for uninterrupted facilitation to the application.

Storage type:

MemcacheD stores variables in its memory & retrieves any information directly from the server memory instead of hitting the database again. On the other hand, Redis is like a database that resides in memory. It executes (reads and writes) a key/value pair from its database to return the result set. Developers use Redis for real-time metrics & analytics too.

Read/Write Speed:

MemcacheD is very good to handle high traffic websites. It can read lots of information at a time and give you back at a great response time. Redis can neither handle high traffic on read nor heavy writes.

Data Structure:

MemcacheD uses strings and integers in its data structure. Hence, everything you save can either be one or the other. With integers, the only data manipulation you can do is adding or subtracting them. If you need to save arrays or objects, you will have to serialize them first and then save them. To read them back, you will need to un-serialize.

In comparison Redis has stronger data structures, which can handle not only strings & integers but also binary-safe strings, lists of binary-safe strings, sets of binary-safe strings and sorted sets.

Key Length:

MemcacheD’s key length has a maximum of 250 bytes, whereas Redis has a maximum of 2GB.

Here is the benchmarking result by DB-Engines, which clearly shows the leader.

Conclusion:

Use Redis, if you need to do operations on cached datasets at once or need to spread one enormous cache over a geographically challenged area. Read-write splitting against caching will enormously help performance and alleviate the cache connection starvation.

On the other hand, you might want to stick to Memcached for its simplicity, reliability and speed.

SEE ALSO: How to Install and Configure Redis Server on Centos/Fedora Server

If you’re thinking anything on Ruby on Rails, get in touch with Andolasoft’s experts. Let’s convert your idea into an App.

Have something to add to this topic? Share it in the comments.

How to Install & Configure Redis-Server on Centos/Fedora Server

‘Redis’ is an Open source key-value data store, shared by multiple processes, multiple applications, or multiple Servers. Key values are more complex types like Hashes, Lists, Sets or Sorted Sets.

Let’s have a quick look on the installation steps of “Redis

Here we go…

Step – 1

First of all we need to switch to superuser & install dependencies:

[code language=”html”]
su
yum install make gcc wget tcl
[/code]

Step-2
Download Redis Packages & Unzip. This guide is based on installing Redis 2.8.3:

[code language=”html”]
wget http://download.redis.io/releases/redis-2.8.3.tar.gz
tar xzvf redis-2.8.3.tar.gz
[/code]

Step-3
Compiling and Installing Redis from the source:

[code language=”html”]
cd redis-2.8.3
make
make install
[/code]

Step- 4

Starting Redis server by executing the following command without any argument:

[code language=”html”]
redis-server
[/code]

Step-5

Check if Redis is working. To check, send a PING command using redis-cli. This will return ‘PONG’ if everything is fine.

[code language=”html”]
redis-cli ping
PONG
[/code]

Step-6

Add Redis-server to init script. Create a directory to store your Redis config files & data:

[code language=”html”]
mkdir -p /etc/redis
mkdir -p /var/redis
[/code]

Also we need to create a directory inside “/var/redis” that works as data &  a working directory for this Redis instance.

[code language=”html”]
mkdir /var/redis/redis
[/code]

Step-7

Copy the template configuration file you’ll find in the root directory of Redis distribution into /etc/redis/

[code language=”html”]
cp redis.conf /etc/redis/redis.conf
[/code]

Edit the configuration file, make sure to perform the following changes:

  • Set daemonize to yes (by default it’s set to ‘No’).
  • Set the pidfile to /var/run/redis.pid
  • Set your preferred loglevel
  • Set the logfile to /var/log/redis.log
  • Set the dir to /var/redis/redis
  • Save and exit from the editor

Step-8 
Add the Redis init script.

[code language=”html”]
vi /etc/init.d/redis
[/code]

And paste the following codes to it

[code language=”html”]
#!/bin/sh
#
# chkconfig: 345 20 80
# description: Redis is an open source (BSD licensed), in-memory data structure store, used as database, cache and message broker.

# Source function library.
. /etc/init.d/functions

REDISPORT=6379
EXEC=/usr/local/bin/redis-server
CLIEXEC=/usr/local/bin/redis-cli

PIDFILE=/var/run/redis.pid
CONF="/etc/redis/redis.conf"

case "$1" in
start)
if [ -f $PIDFILE ]
then
echo "$PIDFILE exists, process is already running or crashed"
else
echo "Starting Redis server…"
$EXEC $CONF
fi
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist, process is not running"
else
PID=$(cat $PIDFILE)
echo "Stopping …"
$CLIEXEC -p $REDISPORT shutdown
while [ -x /proc/${PID} ]
do
echo "Waiting for Redis to shutdown …"
sleep 1
done
echo "Redis stopped"
fi
;;
restart)
stop
start
;;
*)
echo "Please use start or stop as first argument"
;;
esac
exit 0
[/code]

Save the file and exit from the editor.

Step-9
Give appropriate permission to the init script

[code language=”html”]
chmod u+x /etc/init.d/redis
[/code]

Step-10
To run the Redis server at startup we need to add it to the chkconfig list.

[code language=”html”]
chkconfig –add redis
chkconfig –level 345 redis on
[/code]

Step-11
Finally we are ready to start the Redis Server.

[code language=”html”]
/etc/init.d/redis start
[/code]

The redis server will start automatically on system boot.

Conclusion:

‘Redis’ also supports datatypes such as Transitions, Publish and Subscribe. ‘Redis’ is considered more powerful than ‘Memcache’. It would be smart to bring ‘Redis’ into practice and put ‘Memcache’ down for a while.

We provide one-stop solution by utilizing Redis server with Rails , PHP applications and deploy in cloud services such as AWS to make sure that the application is fully scalable.

You can also check the compression of Memcached vs Redis, to know more information on which one to pick for Large web apps?

Do you have anything to add here? Share your thoughts with comments.

It’s always pleasure to hear from you and for5 any assistance and support on AWS you can write us at info@andolasoft.com.