Linux--redis installation and configuration and opening of multiple ports

Source: Internet
Author: User
Tags install redis

Redis needs to be installed during Workerman development to store User IP, port information, etc.

First, install Redis in Ubuntu:

apt-update  //更新apt包源apt-get install redis-server //安装redis-server

You can start Redis directly after the installation is complete:

redis-server

Redis starts the default configuration file since it is not followed by a boot profile

And then we'll take a look at the Redis file distribution

dpkg -L redis-server

From the top down several key files:

/etc/init.d/redis-server-------------Redis Executable program

/etc/redis/redis.conf----------------Redis configuration file

/usr/bin/redis-server---------------Redis self-boot files

If you're running Redis on a single instance, then there's no need to worry about it, so if you want to run multiple instances of Redis, you need to work with Redis files.

First we need to know that a Redis instance is a node, each node is assigned a port number, and each node corresponds to a redis.conf configuration file.

The port number for the Redis default configuration is 6379, assuming you now want to configure more than one 6380, we can directly copy redis.conf named Redis6380.conf, and edit the configuration file

cp /etc/redis/redis.conf /etc/redis/redis6380.confvi /etc/redis/redis6380.conf

Several parameters need to be modified

pidfile //run/redis/redis6380-~//log/redis/redis6380-~

Then save it and start the configuration file directly.

redis-server /etc/redis/redis6380.conf

We can view the next process

ps auxf | grep redis-server

The discovery did start with two Redis ports, but the two Redis process users were different, one redis and one root. If you want users to be redis, we can directly copy the/etc/init.d/redis-server self-boot file and modify the parameters

cp /etc/init.d/redis-server /etc/init.d/redis6380vi /etc/init.d/redis6380

Then quit restarting redis6380.conf to see the process

It's normal now!

Linux--redis installation and configuration and opening of multiple ports

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.