[Linux.centOS]. Tencent cloud mounted Redis

surroundings

{
    "服务器运营商":"腾讯云",
    "操作系统":"CentOS 7.5 64位",   
    "CPU":"1核",
    "内存":"2GB",
    "公网带宽":"1Mbps"
}

You need to master the skill points


{
    "Linux技能":
    {
        "vim命令":"打开文本,编辑文本,保存",
        "文件夹基本操作":"创建文件夹,解压缩文件,复制"
    },
    "通用技能":
    {
        "搜索":"从网络上搜索相关知识点"
    }
}

Compiled and installed using {Redis}

0.0 [warm-up .gcc]. To see if installed gcc

1. Q: gcc is valid (the What)?
{Gcc} replied: I am a compiler that can compile C language ... (N word omitted)

2. Q: Why would install gcc (Why)?
{} Redis replied: I am using C language, and gcc can compile I happened to this article is talking about ... in fact, I compiled and installed in order to use gcc the "make" command.


[root@VM_0_12_centos ~]# rpm -qa|grep gcc*
libgcrypt-1.5.3-14.el7.x86_64
pkgconfig-0.27.1-4.el7.x86_64
libgcc-4.8.5-36.el7.x86_64
gcc-4.8.5-36.el7.x86_64

If it is installed, see step {1.0}.

0.1 [warm-up .gcc]. Install gcc

[root@VM_0_12_centos ~]# yum install gcc-c++

Loaded plugins: fastestmirror, langpacks
//省略N行...

Installed:
  gcc-c++.x86_64 0:4.8.5-39.el7
Dependency Installed:
  libstdc++-devel.x86_64 0:4.8.5-39.el7
Complete!

1.0 [redis]. Downloads from the Internet archive


#先创建一个(级联)目录,用来存放{Redis压缩包}
[root@VM_0_12_centos ~]# mkdir -p usr/{bin,lib/{redis}}
[root@VM_0_12_centos ~]# cd usr/lib/redis

#下载{Resis压缩包}
[root@VM_0_13_centos redis]$ wget https://mirrors.huaweicloud.com/redis/redis-5.0.5.tar.gz


#解压缩.
[zf@VM_0_13_centos redis]$ tar -zxvf redis-5.0.5.tar.gz

1.1 [redis]. Compile


#进入文件夹
[zf@VM_0_13_centos redis]$ cd redis-5.0.5/

#编译(gcc善良登场)
[zf@VM_0_13_centos redis-5.0.5]$ make
#省略N行输出...
Hint: It's a good idea to run 'make test' ;)
make[1]: Leaving directory `/home/zf/usr/lib/redis/redis-5.0.5/src'

1.2 [redis]. Installation Services


#安装服务
[zf@VM_0_13_centos redis-5.0.5]$ make PREFIX=/home/zf/usr/local/redis install

#检查服务是否安装成功
[zf@VM_0_13_centos redis-5.0.5]$ ls /home/zf/usr/local/redis/bin/

redis-benchmark  redis-check-rdb  redis-sentinel
redis-check-aof  redis-cli        redis-server

1.3 [redis]. Configuration files. Copy


#先将解压缩目录下的配置文件复制到安装目录下
#[zf@VM_0_13_centos ~]$ ls usr/lib/redis/redis-5.0.5
#[zf@VM_0_13_centos ~]$ ls usr/local/redis/
#前两句ls命令,只是为了看下复制涉及的两个文件夹中都有些什么...
#可以理解为下载的压缩包为了咱们准备了一个默认的配置文件
[zf@VM_0_13_centos ~]$ cp usr/lib/redis/redis-5.0.5/redis.conf usr/local/redis/

1.4 [redis]. Profile. Edit

This step is the full text of my longest time, because {vim} are not familiar ...

Related to configuration items, originally wrote the introduction for a long period of these configuration items.
But they thought all deleted ... {Redis} to follow suit to run up then.
Novice to see details of these configuration items not necessary.
older drivers these presentations and do not see, so I deleted ...

[
    "bind",
    "protected-mode",
    "daemonize",
    "requirepass"
]
#先跳转到安装目录下,也就是{redis.conf}所在的目录.
[zf@VM_0_13_centos ~]$ cd usr/local/redis/

Below this vim command, the fee was really old strength ... to share ...


[zf@VM_0_13_centos redis]$ vim +/^bind\\s127 redis.conf
[zf@VM_0_13_centos redis]$ vi +/^protected-mode redis.conf
[zf@VM_0_13_centos redis]$ vi +/^daemonize redis.conf
#其中设置密码的配置项{requirepass}没有找到...自己添加就行了.
[zf@VM_0_13_centos redis]$ vi +/^requirepass  redis.conf

1.5 [redis]. Start

And finally to this step.


#跳转到Redis安装目录
[zf@VM_0_13_centos ~]$ cd usr/local/redis/
#启动redis-server,并且指定配置文件
[zf@VM_0_13_centos redis]$ ./bin/redis-server ./redis.conf

#查看服务是否启动
[zf@VM_0_13_centos redis]$ ps -ef|grep redis
zf       19856     1  0 17:48 ?        00:00:00 ./bin/redis-server *:6379
zf       20053 21781  0 17:50 pts/3    00:00:00 grep --color=auto redis

1.6 [redis]. Extension. Casually practiced hand

In fact, to step {1.5}, {after starting up the Redis}, {1.6} of the contents do not belong to this chapter.


[zf@VM_0_13_centos redis]$ ./bin/redis-cli
127.0.0.1:6379> set "name" "zf"
OK
127.0.0.1:6379> exit
[zf@VM_0_13_centos redis]$ ./bin/redis-cli
127.0.0.1:6379> get "name"
"zf"
127.0.0.1:6379> exit
[zf@VM_0_13_centos redis]$ ./bin/redis-cli shutdown
[zf@VM_0_13_centos redis]$ ./bin/redis-cli
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected>

Postscript. Miscellaneous words broken language

This chapter describes the installation {Redis}, {gcc} speak first step of the installation,
there must be a relationship is easy to see, {gcc} and {Redis} between, and is dependent on {Redis} {gcc}.
but some tutorials, but directly up [the first step, the second step, the third step ...] in this way,
especially at that time just getting started with Linux, see the article stumbled.
from this can be considered a draw some lessons later write your own articles,
detailed description of some of the major steps as much as possible, hoping the novice can see and understand.
after all, this article, in addition to my own future to see and the rest should all look at the novice.
for starters how to learn, I particularly agree from "Java programming ideas. Fourth Edition" in the passage.

I think it helps to understand only the language of things introduced to the reader, rather than everything I know things are shaking out, this is not everything he knows. Wo
Renwei importance of information is the existence of a reasonable level. Some cases 95% of the programmers never have to know. Such as the forced learning,
it will only interfere with their normal thinking, thus deepening the difficulty of language in front of them manifested. C language, for example, if you can remember operator
priority list (I do not remember), then you can write more "smart" code. But then a layer of depth think, that makes the code reader
/ maintainer bothered. So forget those who order it, when in doubt parentheses can be. - ". Java programming ideas, the fourth edition of"

Spread

Q:? Yum install gcc yum install gcc-c ++ what difference and
A: Answer description link

This package adds C++ support to the GNU Compiler Collection.
It includes support for most of the current C++ specification,
including templates and exception handling。

It can be seen gcc-c ++ c ++ language features provide support for gcc fact, the concept in terms of gcc gcc refers to the entire collection of this set of tools, it is divided into gcc gcc front-end and back-end (my personal understanding as gcc shell and gcc engine), gcc distal end corresponding to various specific languages ​​(such as c ++ / go, etc.) is performed (for a particular language c ++ / go like syntax checking corresponding code conversion c ++ / go language such as c-code, etc.), gcc corresponding to the rear end of the front end of the c code into assembly or machine code with your PC and other related hardware. (Might describe a not particularly accurate, but in general is what I mean) And in terms of software packages, gcc.rpm is that gcc back end, but gcc-c ++. Rpm is gcc c ++ front end for this particular language. This design ensures sufficient flexibility for different programming languages, only need to develop a different gcc front-end like; at the same time for the user, if I only need to compile c ++ support, then I just installed a c ++ gcc like the front end, the program code does not contain another language features, so that the user software environment clean and relatively light weight, and

excerpt

  • "Java programming ideas. Fourth Edition"
  • https://segmentfault.com/q/1010000009371177/a-1020000009371340
  • https://cloud.tencent.com/developer/article/1532497

Guess you like

Origin www.cnblogs.com/love-zf/p/11973796.html