Linux system Installation NoSQL (MongoDB and Redis) steps and Problem Solving (summary) _linux

Source: Internet
Author: User
Tags install mongodb mkdir mongodb redis

The following is a record of my work, which describes the installation process of Nosql:mongodb and Redis under Linux system and the problems encountered and solutions:

Need friends can follow the following steps to install, can quickly install MongoDB and Redis, hope can help everyone:)!

First, MongoDB

1, MongoDB Installation

(1) Copy the installation package mongodb-linux-i686-3.0.2.tgz to the server to be installed

Here I use the RZ command if it is not supported to install Yum-y install Lrzsz

(2) Unzip the installer tar xzvf mongodb-linux-i686-3.0.2.tgz

(3) Enter directory:/usr/local/Create folder mkdir MongoDB

(3) Moving files to the/usr/local/mongodb directory:

<span style= "font-family: Microsoft Yahei"; font-size:15px ">MV mongodb-linux-i686-3.0.2/*/usr/local/mongodb

Enter/usr/local/mongodb execution </span>

(4) mkdir data

(5) Touch logs

(6) Enter the bin directory to perform the boot

<span style= "font-family: Microsoft Yahei"; font-size:15px ">/mongod--dbpath=/usr/local/mongodb/data/--fork--logpath=/usr/local/mongodb/logs

Description:--dbpath Specifies to store MongoDB library data

--fork backstage execution, otherwise always front desk execution

--LOGPATH Specifies the MongoDB log file

Error:-bash:./mongod:/lib/ld-linux.so.2:bad ELF interpreter:no such file or directory

Solution: sudo yum install glibc.i686

Error:./mongod:error while loading shared libraries:libstdc++.so.6:cannot open Shared object file:no such file or Directo Ry

Solution: Yum provides libstdc++.so.6 see which contains so.6 check

libstdc++-4.8.5-4.el7.i686, and then perform the installation

Yum Install libstdc++-4.8.5-4.el7.i686 perform installation

Error: error:protected multilib versions:libstdc++-4.4.7-4.el6.i686!=

Libstdc++-4.4.7-3.el6.x86_64

Workaround: Yum update libstdc++-4.4.7-11.el6.x86_64 and then perform the steps yum install libstdc++-4.4.7-4.el6.i686

After the installation is successful, start at execution./mongod--dbpath=/usr/local/mongodb/data/--fork--logpath=/usr/local/mongodb/logs</span>

(7) View the MongoDB process (all of the following two are available)

<span style= "font-family: Microsoft Yahei"; font-size:15px "> Netstat-tlnup|grep mongod
netstat-tlnup|grep 27017</span>

2, MongoDB start:

(1) Entering/usr/bin

(2) Execute the command to connect the client:./mongo

3. View Startup status:

<span style= "font-family: Microsoft Yahei"; font-size:15px ">netstat-lntup|grep 27017
> show dbs;
Db.stats () Use
test;</span>

At this point, Redis has been installed and tested successfully, you can safely use:

Second, Redis

Redis is divided into service side and client, we first install the server, the actual is the C language to compile, the success of the compilation is successful installation, and then start the Client Connection server to test.

1, Installation Redis service end

(1) Download the installation package

Perform the wget command download under the appropriate directory (/OPT) of the server:

<span style= "font-family: Microsoft Yahei"; font-size:15px ">wget https://redis.googlecode.com/files/redis-2.6.13.tar.gz

Error: Permission denied

Reason: Current user ec2-user to opt this folder does not have W permission

Solution: Sudo-i chmod a+x/opt enables current users to have executive permission on opt files </span>

(2) Decompression installation package

<span style= "font-family: Microsoft Yahei"; font-size:15px "> Tar xzf redis-2.6.13.tar.gz</span>

(3) Compiling

<span style= "font-family: Microsoft Yahei"; font-size:15px "> into the redis-2.6.13 directory for compilation

1) CD redis-2.6.13

2) Make

Error:/bin/sh:cc:command not found

Reason: no C language compilation environment

Solution: Yum Install gcc

Continue with the build installation

3) Make install</span>

(4) Copy redis.conf to etc folder

<span style= "font-family: Microsoft Yahei"; font-size:15px "> CP redis.conf/etc/</span>

2, Start Redis

(1) Enter the catalogue Redis SRC:CD/OPT/REDIS-3.0.0/SRC

(2) Start the service side (src directory):./redis-server &

or execute src/redis-server in the redis-3.0.0 directory

(3) Open client (src directory):./REDIS-CLI &

or execute SRC/REDIS-CLI in the redis-3.0.0 directory

3, Test Redis installation

Two ways to test whether the Redis started successfully, choose either

(1) Detect if the 6379 port is listening

<span style= "font-family: Microsoft Yahei"; font-size:15px ">NETSTAT-LNTP | grep 6379</span>

(2) Detect if the background process exists

<span style= "font-family: Microsoft Yahei"; font-size:15px ">ps-ef |grep redis</span>

4. Perform Redis test

<span style= "font-family: Microsoft Yahei"; font-size:15px ">127.0.0.1:6379> set name Yhb
OK
127.0.0.1:6379> get name
" YHB "
127.0.0.1:6379></span>

At this point, Redis has been installed and tested successfully, you can safely use:

The above is a small set to introduce the Linux system installation NoSQL (MongoDB and Redis) steps and problem solving, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.