Redis's Make,make test,make install, standalone multi-instance configuration, and API program write data!

Source: Internet
Author: User
Tags redis server

Recently studied Liaoliang Teacher's Big Data mushroom cloud initiative to implement data from spark streaming analysis to Redis. Today is just the beginning.

First, Ubuntu16 installation Redis3.2.1

Encountered a lot of problems, among them, make is not a problem, make Test when, appeared:


!!! WARNING The following tests failed:


[err]: Slave should is able to synchronize with the master in TESTS/INTEGRATION/REPLICATION-PSYNC.TCL

Replication not started.

Cleanup:may take some time ... Ok

Makefile:215:recipe for target ' test ' failed

MAKE[1]: * * * [Test] Error 1

MAKE[1]: Leaving directory '/HOME/DYQ/DOCUMENTS/REDIS-3.2.1/SRC '

Makefile:6: Recipe for target ' test ' failed

Make: * * * [Test] Error 2


It seems that there is no sync connection with master, but am I not yet installed?


Baidu, saw a piece of article, said is with this command: Makecflags= "-march=i686"

But the direct error, no way.

to ignore this error, run make install directly:

CD src && make install

MAKE[1]: Entering directory '/HOME/DYQ/DOCUMENTS/REDIS-3.2.1/SRC '


Hint:it ' s a good idea to run ' make test ';)


Install Install

Install:cannot Create regular file '/usr/local/bin/redis-server ': Permission denied

Makefile:256:recipe for target ' install ' failed

MAKE[1]: * * [Install] Error 1

MAKE[1]: Leaving directory '/HOME/DYQ/DOCUMENTS/REDIS-3.2.1/SRC '

Makefile:9: Recipe for target ' install ' failed

Make: * * * [install] Error 2


Permissions?

sudo make

sudo make install

Prompt error, to enter SRC

All right, ok!.


\o/all tests passed without errors!

Cleanup:may take some time ... Ok


The error continues to occur:

[Exception]: Executing test client:noreplicas Not enough good slaves to write.

Noreplicas not enough good slaves to write.


Continue to find Niang:

https://my.oschina.net/u/1049845/blog/203370

This article has a description:

You may encounter time-related failures in make test, such as

Executing test client:noreplicas Not enough good slaves to write:

In this case, you can modify the file Tests/integration/replication-2.tcl and change after 1000 to after 10000 to extend the wait time.

Modify, continue to error!

!!! WARNING The following tests failed:


[Err]: Pexpire/psetex/pexpireat can set sub-second expires in TESTS/UNIT/EXPIRE.TCL

Expected ' somevalue {} ' to equal or match ' {} ' {} '

[Err]: Slave should is able to synchronize with the master in TESTS/INTEGRATION/REPLICATION-PSYNC.TCL

Replication not started.

Cleanup:may take some time ... Ok

Makefile:215:recipe for target ' test ' failed

Make: * * * [Test] Error 1

Pay attention to the error message, pay attention to the error message, pay attention to the error message!

is to modify the TESTS/UNIT/EXPIRE.TCL:

tags {"slow"} {

Test {Expire-after 2.1 seconds the key should no longer be here} {

After 21000

list [r get x] [r exists x]

} {{} 0}

}


Test {expire-write on EXPIRE should work} {

R del X

R Lpush x foo

R expire x 10000

R Lpush X Bar

R Lrange x 0-1

} {bar Foo}


Finally saw the green:

\o/all tests passed without errors!

How many pits!!!


[Email protected]:~/documents/redis-3.2.1$ sudo make install

CD src && make install

MAKE[1]: Entering directory '/HOME/DYQ/DOCUMENTS/REDIS-3.2.1/SRC '


Hint:it ' s a good idea to run ' make test ';)


Install Install

Install Install

Install Install

Install Install

Install Install

MAKE[1]: Leaving directory '/HOME/DYQ/DOCUMENTS/REDIS-3.2.1/SRC '



When installed in the virtual machine, the machine performance is not enough, it is easy to appear the above error! Change the machine or change the parameters, and when the machine is not busy to compile and install, will pass!

Instructions on git:


For timing issues, one test isn ' t very representative. Did you try running them 5-10 times? Is there anything unusual about your machine (very small memory, very slow, gkfx, overloaded, etc)? Some of the tests is based on timing, so if the machine can ' t deliver results in time and tests can ' t complete properly. (You can manually edit some of the tests to increase the timeout waiting)

In the SRC directory, enter Redis-server, enter the familiar interface, look at the hint, the configuration file is

29181:c Oct 13:48:16.321 # warning:no config file specified, using the default Config. In order to specify a config file use Redis-server

/path/to/redis.conf

Forget it, or specify a configuration file, in the upper directory, there is a redis.conf.


Src/redis-server redis.conf


Second, the configuration Redis3.2.1

1, configure the production environment, and set up the Redis boot.

First, create a folder to hold the Redis configuration file and persist the RDB data:

sudo mkdir/etc/redissudo Mkdir/var/redis

Copy the Redis startup script into the/etc/init.d folder:

sudo cp utils/redis_init_script/etc/init.d/redis_6379

Copy the Redis configuration file to/etc/redis and use the port number as the file name:

sudo cp redis.conf/etc/redis/6379.conf

Create a folder in/var/redis as the data and working directory for your Redis instance:

sudo mkdir/var/redis/6379


Modify the configuration file as required below:

    • Set demonize to Yes (default is NO)

    • Set Pidfile to/var/run/redis_6379.pid

    • Set LogLevel to the appropriate level

    • Set LogFile to/var/log/redis_6379.log

    • Set Dir to/var/redis/6379

Redis-server/etc/redis/6379.conf

REDIS-CLI Client Connection server, enter set name= "Dyq"

Get Dyq with Get name. Success!


The official configuration document address for Redis is: Http://redis.io/topics/quickstart

In order to remotely connect to the Redis server, you need to modify the/etc/redis/6379.conf to change the ip_bind from 127.0.0.1 to 192.168.0.10.


Third, the installation of single-machine multi-instance Redis


1. Copy the configuration file

Cp/etc/6379.conf/etc/6380.conf

Cp/etc/6379.conf/etc/6381.conf


2. Modify the configuration file

sudo gedit /etc/6380.conf

Modify

Bind 192.168.0.10

Port 6380

Daemonize Yes

Logfile/var/log/redis_6380.log

dir/var/redis/6380/

Pidfile/var/run/redis_6380.pid


To create a file directory:

sudo mkdir/var/redis/6380/

sudo gedit/var/log/redis_6380.log


3, modify the master and slave settings

The 6380.conf in the

Slaveof 192.168.0.10 6379


4. Verify Master-Slave synchronization

Start 6380 and 6381


[Email protected]:~/documents/redis-3.2.1$ src/redis-server.sh/etc/redis/6380.conf

-bash:src/redis-server.sh:no such file or directory

[Email protected]:~/documents/redis-3.2.1$ src/redis-server/etc/redis/6380.conf


FATAL CONFIG FILE ERROR * * *

Reading the configuration file, at line 163

>>> ' Logfile/var/log/redis6380.log '

Can ' t open the log file:permission denied


You can find that the real file does not have write permissions. sudo chown dyq/var/log/redis6380.log


SRC/REDIS-CLI- H 192.168.0.10 -P 6379

>set name= ' Testredis '

>get Name


Log in from library:

Src/redis-cli-h 192.168.0.10-p 6380

>get Name


SRC/REDIS-CLI- H 192.168.0.10 -P 6381

>get Name


You can see the master-slave data synchronization. Success!


Iv. remote access to Redis from Ides and write data


Redis's Make,make test,make install, standalone multi-instance configuration, and API program write data!

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.