This is the first day of my participation in Gwen Challenge
preface
Redis is used very frequently in enterprise-level projects, the most impressive is its rich data structure and excellent performance, in the cache, distributed lock, distributed session, control interface power and so on application level, also all highlight Redis powerful, so for Java developers, Redis should be on your list of essential skills
This series I am going to from the beginner’s point of view a little bit of Redis this road, from the installation -> data structure understanding ->demo case -> underlying implementation principle -> enterprise application practice, this idea to analyze, I hope to bring you a more clear Redis series
So I start today’s purpose and hope this series will get a good start: Redis environment building
Environment to prepare
Redis server
In order to save trouble, I directly in Ali cloud bought the cheapest server, there is no content inside
System and Terminal
- System: macOS
- Terminal: iTerm
Download and install Redis
Connecting to the server
When the environment is ready, the first step is to connect to the server where Redis resides. I’m using iTerm here
- Run the following command to connect remotely to the IP address shown in the figure below
SSH root@< Public IP address of the Linux server >Copy the code
-
Type yes, then press Enter. When you connect to the remote server for the first time, the system cannot confirm the authenticity of the remote server and can only provide the public key fingerprint of the server and ask you whether to continue the connection. Enter yes to indicate that you trust the server
-
Enter the Linux server login password and press Enter.
- The following figure indicates that the Redis server has been connected
Download and install Redis
Install GCC
yum install gcc
Download, unzip and compile Redis
$ wget https:/ / download. Redis. IO/releases/redis - 6.2.4. Tar. Gz
$ tar xzf redis-6.24..tar.gz
$ cd redis-6.24.
$ make
Copy the code
- Download the Redis
- Unpack the Redis
- Go to redis directory and compile Redis
Modify the configuration file to background boot
It’s still in Redis
Change daemonize to yes using the vim tool
Start the Redis
Run the SRC /redis-server redis.conf command to start redis
Through the ps – ef | grep redis command to verify whether started successfully
The above figure shows that Redis has been successfully started and port is 6379
Test Redis
Run SRC /redis-cli to start the Redis client
A case for testing String:
Set String and GET String are both ok, proving that the Redis test is successful
Exit the Redis client
Run the quit command to exit the client
Exit the Redis service
pkill redis-server
kill
Process of no.src/redis-cli shutdown
I’m going to demonstrate pkill Redis-server, and the rest of you are going to try it yourself
Through the ps – ef | grep redis command found redis service has been closed
omg
Finally, if you feel confused about the article, please leave a comment immediately. If you think I have something to ask for a thumbs up 👍 for attention ❤️ for share 👥 is really very useful for me!! If you want to get Redis related books, you can pay attention to the wechat public account Java encyclopedia, enter Redis, you can get, finally finally, thank you for your support!!