Environmental Science Centos7

Redis edition 3.2.0

The installation directory /usr/local/redis/redis-3.2.0

Redis Introduction to

See the official website

install

1 install gcc And tcl

# yum install gcc tcl 





2 download 3.2.0

# mkdir /usr/local/redis 

# cd /usr/local/redis 

# wget http://download.redis.io/releases/redis-3.2.0.tar.gz





3 decompression

# tar -zxvf redis-3.2.0.tar.gz

# mv rredis-3.2.0.tar.gz redis3.2.0

# cd redis3.2.0





4 install

# make test

Some small errors may be reported during installation , You can see the tips

After installation , as follows









src Directory is redis-server,redis-cli Wait for the order

Configure as a service

5 Configure as a service

Redis The startup script for is :/usr/local/redis/redis-3.2.0/utils/redis_init_script 

Copy the startup script to /etc/init.d/redis Under the table of contents , And named it redis: 

# cp /usr/local/redis/redis-3.2.0/utils/redis_init_script /etc/init.d/redis

///////////////

Here's a digression ,linux There is one /etc/init.d There's also a folder /etc/rc.d/init.d Folder

What's the difference between the two ?









/etc/init.d yes /etc/rc.d/init.d A soft connection of

So what is soft connection





ln 3.txt 4

hold 3.txt Copy one as 4

But modify 3.txt after , stay 4 You can see changes on the Internet

modify 4 In the after 3.txt You can see changes on the Internet

But after deleting one of the two , The other one won't be deleted .

ln 3.txt 4 It's called hard connection





ln -s 3.txt 5 It's called soft connect

above s No soft, yes symboilc

Is to 3.txt Create a new one called 5 Shortcut to

So delete 5,3.txt still OK Of

But if it's deleted 3.txt, that 5 It can't be used .

///////////////

Of course redis_init_script We have to change it a little bit redis_init_script

So I'll post my changes , Let's compare ourselves redis_init_script

#!/bin/sh
#
# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem.
REDISPORT=6379
EXEC=/usr/local/redis/redis-3.2.0/src/redis-server
CLIEXEC=/usr/local/redis/redis-3.2.0/src/redis-cli
PIDFILE=/var/run/redis_${REDISPORT}.pid
CONF="/usr/local/redis/redis-3.2.0/conf/${REDISPORT}.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
;;
*)
echo "Please use start or stop as first argument"
;;
esac

We're going to change these places :

(1)  REDISPORT Port hold 6379 unchanged ;( Be careful , The port name will be related to the following profile name ) 

(2)  EXEC=/usr/local/bin/redis-server Change it to EXEC=/usr/local/redis/redis-3.2.0/src/redis-server 

(3)  CLIEXEC=/usr/local/bin/redis-cli Change it to CLIEXEC=/usr/local/redis/redis-3.2.0/src/redis-cli 

(4)   Profile Settings : 

establish redis Profile directory  

We know , Direct operation redis-3.2.0/src/redis-server Yes. , But we usually add a configuration file to it

# mkdir /usr/local/redis/conf 

Copy redis The configuration file /usr/local/redis/redis-3.2.0/redis.conf To /usr/local/redis/conf Directory and press port

The number was renamed 6379.conf 

# cp /usr/local/redis/redis-3.2.0/redis.conf /usr/local/redis/redis-3.2.0/conf/6379.conf 

After the above preparation , Right again CONF The attributes are adjusted as follows : 

CONF="/etc/redis/${REDISPORT}.conf" Change it to CONF="/usr/local/redis/redis-3.2.0/conf/${REDISPORT}.conf" 

(5)   change redis Open command , Execute the way the back desk runs : 

$EXEC $CONF &    #“&” The function is to transfer the service to the later running  







stay /etc/systemd/system Write down the service file

# cd /etc/systemd/system
# vi redis_6379.service
[Unit]
Description=Redis on port 6379
[Service]
Type=forking
ExecStart=/etc/init.d/redis start
ExecStop=/etc/init.d/redis stop
[Install]
WantedBy=multi-user.target

Opening service

systemctl start  redis_6379.service

Use java Remote testing

I won't post the code , There are a lot of them on the Internet

But as far as the configuration is concerned , We're remote java There must be something wrong with the connecting iron

I'll probably report these two mistakes

Could not get a resource from the pool, Connection refused: connect

DENIED Redis is running in protected mode because protected mode is enabled…

The problem lies in , default conf The file is bound to the native ip, We have to comment out

second , Remote access with password , We have to be in conf Set in the ( How to set the password , Baidu yourself )

See

http://blog.csdn.net/yingxiake/article/details/51472810

Reference material

Wu Shuicheng Dubbo Video tutorial redis Installation and use of

http://blog.csdn.net/yingxiake/article/details/51472810

Centos7 Next Redis3.2 Installation configuration and JReid More articles about testing

  1. original :centos7.1 Next ZooKeeper Cluster installation configuration +Python Examples of actual combat

    centos7.1 Next ZooKeeper Cluster installation configuration +Python Examples of actual combat download :http://apache.fayea.com/zookeeper/zookeeper-3.4.9/zookeepe ...

  2. centos7 Next mysql5.7 Installation and configuration

    centos7 Next MySQL5.7 Installation and configuration download Download address Select the four in the red box according to the system and version RPM Just download the package , Then put centos7 In the system /opt Under the table of contents , Wait to install later . Preparation before installation 1. Check the system ...

  3. centos7 Under the source mode installation gitlab8.9+ Send E-mail +ldap

    CentOS7 Under the source mode installation gitlab Description of the environment operating system : centos7 redis: >=2.8 mysql >=5.5.14 git >=2.7.4 Architecture design a gitl ...

  4. inux centos7 Under the source code tar install 5.7.26 Detailed explanation

    inux centos7 Under the source code tar install 5.7.26 Graphic, Official website address  https://dev.mysql.com/downloads/mysql/ 1. uninstall Linux It comes with the system mysql plug-in unit (o ...

  5. CentOS7 Next MySQL5.7 Installation -RPM The way

    Installing MySQL on Linux Using RPM Packages Download installation package mysql Download address :https://dev.mysql.com/downloads/mysql/ ...

  6. Linux Next apache+phppgadmin+postgresql Installation configuration

    Linux Next apache+phppgadmin+postgresql Installation configuration operating system :CentOS Installation package :httpd( The preferred yum), php( Include php as well as php-pgsql,php-mbstri ...

  7. 【 turn 】android newest NDK r8 stay window Build the development environment Configuration and use Explain in detail the picture and text , Complete record of actual configuration process ( original )

    Original website :http://www.cnblogs.com/zdz8207/archive/2012/11/27/android-ndk-install.html android newest NDK r8 stay w ...

  8. Windows 8.1 Next MySQL Green version installation configuration and use

    original text :Windows 8.1 Next MySQL Green version installation configuration and use Mysql-5.6.17-winx64 Operation steps : One . install MySQL database 1. download . Download address :http://downloads.my ...

  9. android newest NDK r8 stay window Build the development environment Configuration and use Explain in detail the picture and text , Complete record of actual configuration process ( original )

      android newest NDK r8 stay window Build the development environment Configuration and use Explain in detail the picture and text , Complete record of actual configuration process ( original ) I've always wanted to do NDK Development has been delayed by other things , Referring to some information on the Internet, I finally put ...

Random recommendation

  1. java Why can't there be... In a non static inner class static Decorated attributes , But there can be constants ?

    Such as :public class InnerClassDemo{int x;class A{static int a = 0;// It's illegal to write like this .static final int b=0;// It's right to write like this ...

  2. svn: E155004 'XX' is already locked

    Error:svn: E155004: Run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)svn: E155 ...

  3. node The event loop

    What is the event cycle Node Running on a single thread , At least from Node.js The developer's perspective is like this . In the underlying , Node It's through libuv To implement multithreaded . Libuv The library is responsible for Node API Implementation . It assigns different tasks ...

  4. csdn Ninth place

    Number :1025 Time :2016 year 7 month 18 Japan 10:45:21 function :csdn Ninth place URL :http://blog.csdn.net/augusdi

  5. Linux php/php-fpm install , To configure

    1> download php Source code   #wget  http://cn2.php.net/get/php-5.4.30.tar.gz/from/this/mirror   Official website 5.2 It seems that the version number of is not provided   ...

  6. Five kinds js Judge whether it is an integer ( turn )

    Five kinds js Determine whether it is an integer type author :snandy This article mainly introduces five kinds of JavaScript Determine whether it is an integer type , Friends in need can refer to   This article looks at how to judge an integer type (Integer),JavaS ...

  7. BZOJ3684 Big friends and multi tree ( Polynomial correlation calculation )

    set up $f(x)$ Is the generating function of the tree , namely $x^i$ The coefficient of is the root node and the weight is $i$ The number of trees in the world . It's not hard to get out $f(x)=\sum_{k\in D}f(x)^k+x$ We need the second order of this polynomial $n$ term , From Lagrange inversion, we can get $[x ...

  8. Node bak

    process.on('uncaughtException', function (err) { logger.info('Local Server Exception: ') logger.info ...

  9. JMeter The value has been passed but the prompt is empty

    The value has been transferred when logging in , But it's always empty solve : At the request of url In this paper, the parameters of

  10. codeforces604B

    More Cowbell CodeForces - 604B Kevin Sun wants to move his precious collection of n cowbells from Na ...