亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Redis4.0如何編譯安裝

發布時間:2021-11-16 11:35:59 來源:億速云 閱讀:234 作者:小新 欄目:云計算

小編給大家分享一下Redis4.0如何編譯安裝,希望大家閱讀完這篇文章之后都有所收獲,下面讓我們一起去探討吧!

  1. 小程序測試wget http://download.redis.io/releases/redis-4.0.11.tar.gz

  2. 安裝編譯

  3. 環境centos7 

It is as simple as:


    % make


You can run a 32 bit Redis binary using:


    % make 32bit


After building Redis, it is a good idea to test it using:


    % make test


Fixing build problems with dependencies or cached build options

---------


Redis has some dependencies which are included into the `deps` directory.

`make` does not automatically rebuild dependencies even if something in

the source code of dependencies changes.


When you update the source code with `git pull` or when code inside the

dependencies tree is modified in any other way, make sure to use the following

command in order to really clean everything and rebuild from scratch:


    make distclean


This will clean: jemalloc, lua, hiredis, linenoise.


Also if you force certain build options like 32bit target, no C compiler

optimizations (for debugging purposes), and other similar build time options,

those options are cached indefinitely until you issue a `make distclean`

command.


Fixing problems building 32 bit binaries

---------


If after building Redis with a 32 bit target you need to rebuild it

with a 64 bit target, or the other way around, you need to perform a

`make distclean` in the root directory of the Redis distribution.


In case of build errors when trying to build a 32 bit binary of Redis, try

the following steps:


* Install the packages libc6-dev-i386 (also try g++-multilib).

* Try using the following command line instead of `make 32bit`:

  `make CFLAGS="-m32 -march=native" LDFLAGS="-m32"`


Allocator

---------


Selecting a non-default memory allocator when building Redis is done by setting

the `MALLOC` environment variable. Redis is compiled and linked against libc

malloc by default, with the exception of jemalloc being the default on Linux

systems. This default was picked because jemalloc has proven to have fewer

fragmentation problems than libc malloc.


To force compiling against libc malloc, use:


    % make MALLOC=libc


To compile against jemalloc on Mac OS X systems, use:


    % make MALLOC=jemalloc


Verbose build

-------------


Redis will build with a user friendly colorized output by default.

If you want to see a more verbose output use the following:


    % make V=1


Running Redis

-------------


To run Redis with the default configuration just type:


    % cd src

    % ./redis-server


If you want to provide your redis.conf, you have to run it using an additional

parameter (the path of the configuration file):


    % cd src

    % ./redis-server /path/to/redis.conf


It is possible to alter the Redis configuration by passing parameters directly

as options using the command line. Examples:


    % ./redis-server --port 9999 --slaveof 127.0.0.1 6379

    % ./redis-server /etc/redis/6379.conf --loglevel debug


All the options in redis.conf are also supported as options using the command

line, with exactly the same name.


Playing with Redis

------------------


You can use redis-cli to play with Redis. Start a redis-server instance,

then in another terminal try the following:


    % cd src

    % ./redis-cli

    redis> ping

    PONG

    redis> set foo bar

    OK

    redis> get foo

    "bar"

    redis> incr mycounter

    (integer) 1

    redis> incr mycounter

    (integer) 2

    redis>


You can find the list of all the available commands at http://redis.io/commands.


Installing Redis

-----------------


In order to install Redis binaries into /usr/local/bin just use:


    % make install


You can use `make PREFIX=/some/other/directory install` if you wish to use a

different destination.


Make install will just install binaries in your system, but will not configure

init scripts and configuration files in the appropriate place. This is not

needed if you want just to play a bit with Redis, but if you are installing

it the proper way for a production system, we have a script doing this

for Ubuntu and Debian systems:


    % cd utils

    % ./install_server.sh



4. 采用make PREFIX=/usr/local/redis install

5. 拷貝配置文件mkdir /usr/local/redis/conf

6. cp  redis.conf sentinel.conf  /usr/local/redis/conf

第1個警告(WARNING: The TCP backlog setting of 511 ......)解決辦法

方法1: 臨時設置生效: sysctl -w net.core.somaxconn = 1024

方法2: 永久生效: 修改/etc/sysctl.conf文件,增加一行

net.core.somaxconn= 1024

然后執行命令

sysctl -p

補充:

net.core.somaxconn是linux中的一個kernel參數,表示socket監聽(listen)的backlog上限。

backlog是socket的監聽隊列,當一個請求(request)尚未被處理或建立時,他會進入backlog。

而socket server可以一次性處理backlog中的所有請求,處理后的請求不再位于監聽隊列中。

當server處理請求較慢,以至于監聽隊列被填滿后,新來的請求會被拒絕。

所以說net.core.somaxconn限制了接收新 TCP 連接偵聽隊列的大小。

對于一個經常處理新連接的高負載 web服務環境來說,默認的 128 太小了。大多數環境這個值建議增加到 1024 或者更多。

第2個警告(WARNING overcommit_memory is set to 0! ......)同樣也有兩個解決辦法

方法1: 臨時設置生效: sysctl -w vm.overcommit_memory = 1

方法2: 永久生效: 修改/etc/sysctl.conf文件,增加一行

vm.overcommit_memory = 1

然后執行命令

sysctl -p

補充: 

overcommit_memory參數說明:

設置內存分配策略(可選,根據服務器的實際情況進行設置)

/proc/sys/vm/overcommit_memory

可選值:0、1、2。

0, 表示內核將檢查是否有足夠的可用內存供應用進程使用;如果有足夠的可用內存,內存申請允許;否則,內存申請失敗,并把錯誤返回給應用進程。

1, 表示內核允許分配所有的物理內存,而不管當前的內存狀態如何。

2, 表示內核允許分配超過所有物理內存和交換空間總和的內存

注意:redis在dump數據的時候,會fork出一個子進程,理論上child進程所占用的內存和parent是一樣的,比如parent占用的內存為8G,這個時候也要同樣分配8G的內存給child,如果內存無法負擔,往往會造成redis服務器的down機或者IO負載過高,效率下降。所以這里比較優化的內存分配策略應該設置為 1(表示內核允許分配所有的物理內存,而不管當前的內存狀態如何)。

看完了這篇文章,相信你對“Redis4.0如何編譯安裝”有了一定的了解,如果想了解更多相關知識,歡迎關注億速云行業資訊頻道,感謝各位的閱讀!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

泰兴市| 普宁市| 荆州市| 融水| 邵阳县| 门源| 阿瓦提县| 辉南县| 临颍县| 焉耆| 理塘县| 图片| 玉溪市| 呼伦贝尔市| 巴南区| 溧阳市| 渝中区| 东宁县| 桑植县| 清镇市| 荃湾区| 瓦房店市| 青州市| 道孚县| 永川市| 奈曼旗| 漳平市| 余干县| 郓城县| 无棣县| 黎川县| 丹阳市| 宜兴市| 元氏县| 石河子市| 砚山县| 宜城市| 容城县| 沙坪坝区| 临沂市| 安西县|