In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article is to share with you the content of a sample analysis of Redis installation pitfalls. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Environment: Linux operating system (CentOS)
Installation method: source code installation
Selection of folders
For a Linux rookie like me, in the face of Linux's complex file system, every time I install the software, I still have to struggle with which directory it should be installed in, so I think it is more appropriate to find out which folder to put it in first. As for the specific meaning of so many folders, refer to "Bird's Linux Private Cuisine". The following only describes the meaning of the directory I use.
/ usr (UNIX Software Resource) the place where operating system software resources are stored in this directory
/ usr/bin most users can use the command to put it here
/ usr/local system administrator installs the downloaded software on this computer. It is recommended to install it to this directory, which will be easier to manage.
/ usr/local/src can put the software source package in the src directory, that is, the downloaded redis installation package (such as redis-4.0.11.tar.gz)
Detailed steps
$cd / usr/local/src-- enter the directory where the source code is placed
$wget http://download.redis.io/releases/redis-4.0.11.tar.gz-- download the zip file via wget
$tar-zxvf redis-4.0.11.tar.gz-unzipped the installation package
$ln-s / usr/local/src/redis-4.0.11 / usr/local/redis-- establish a soft connection in the local directory and point to redis-4.0.1
$cd / usr/local/redis-- change to the redis directory
$make-compile (make sure the operating system has gcc installed before compilation, which I don't understand, it's usually installed)
$make install-install
$redis-cli-v-- check whether the installation is successful and display the redis version number
Notes on this process:
In step 2, you can download the file to your own windows system, and it is the same when transferring the file to Linux through the file transfer tool, depending on the network speed or personal habits.
Step 4 the purpose of establishing a soft connection in the local directory is equivalent to renaming, which is more convenient and is said to be a good habit for installing software, but other functions need to be learned.
Step 6 after the installation is complete, you will find several more executable files under / usr/local/bin/, all of which are Redis commands, so you can execute redis commands in any directory. There is no need to configure PATH environment variables, I personally think it is the reason for the chosen installation directory, because some tutorials online also need to configure environment variables, which saves some trouble.
Run away without teaching me how to start it?
The detailed steps have been written, and it also shows that the installation is successful. Do you think it will be installed? In fact, the following is the key experience of avoiding the pit.
Redis Custom configuration
$cd / usr/local/redis-- enter the redis directory to see a redis.conf file, which is a custom configuration file for redis
Vim redis.conf-- use vim to open the redis configuration file. If you don't know the basic usage of vim, you have to learn Google first.
Bind 127.0.0.1-comment out this configuration, otherwise it can only be accessed locally by default and cannot be placed on the server for remote clients to connect
Requirepass yourpassword-uncomment and configure the redis password, which is very important, which will be explained later
Protected-mode-safe mode. Change it to yes. If it is no, it means no password is required to log in.
Save exit
The most important thing above is to set the password, otherwise it will be very insecure, insecure! What exactly is the situation? let's find out.
Password refers to the password required when the client logs in through the redis-cli command, not when the service is started.
For example, I use an Ali cloud server, which is often attacked by hackers recently and becomes a chicken, which is invaded through the port (6379) of redis, because I have not set a password before. Of course, this is not the only reason, as well as Ali Yun's security group settings and so on, which are only known by others. After consultation, it is still in the clouds, but it is good to solve the problem.
Redis start
$redis-server / usr/local/redis/redis.conf &-- load the custom configuration file and start the redis service as a daemon
$redis-cli-a password-- use a password to connect to the redis service
127.0.0.1Plus 6379 > keys *-verify that the server's data can be accessed successfully
This is only a good startup mode that I can understand at present, and of course, there are all kinds of parameters, which need to be learned. Explain the above meaning first.
Redis-server can start the redis service, but start it with the default configuration, that is, the contents of our modified redis.conf will not be loaded. So add the path of the redis.conf configuration file to start by loading the custom configuration file.
The last parameter is interesting. If we start redis-server, the cursor will not return to the command with input state, but the redis service startup state. At this point, we need to switch to the command state with ctrl+c. If the & parameter is not added, the redis service will shut down automatically. The & parameter indicates that redis is started as a daemon so that you can rest assured to do something else after startup. The service is running in the background all the time.
Redis-cli can connect to the redis server without parameters, but cannot do anything. It will prompt (error) NOAUTH Authentication required. Indicates that permission authentication is required. At this point, you need to authenticate through $auth password. Adding parameters to the connection saves trouble.
Windows client tool connection
RedisDesktopManager is the software that can operate redis through the interface on windows, just like mysql also has a desktop tool navicat, it is best to operate through the command line, which is beneficial to learning.
Recommend a SSH (simply understood as connecting to a remote server) tool that feels good recently: XShell, which looks comfortable.
Thank you for reading! This is the end of this article on "sample analysis of Redis installation pitfalls". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 203
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.