1. 程式人生 > 實用技巧 >部署redis6.0 常見問題

部署redis6.0 常見問題

問題1:在make的時候,提示如下錯誤:

server.c:5170:39: error: ‘struct redisServer’ has no member named ‘maxmemory’
if (server.maxmemory > 0 && server.maxmemory < 1024*1024) {
                                  ^
server.c:5171:176: error: ‘struct redisServer’ has no member named ‘maxmemory’
    serverLog(LL_WARNING,"WARNING: You specified a maxmemory value that is less than 1MB (current value is %llu bytes). Are you sure this is what you really want?", server.maxmemory);
                                                                                                                                                                           ^
server.c:5174:31: error: ‘struct redisServer’ has no member named ‘server_cpulist’
redisSetCpuAffinity(server.server_cpulist);

解決辦法:
出現這種錯誤是由於gcc版本太低,升級gcc

# 檢視gcc版本是否在5.3以上,centos7.6預設安裝4.8.5
gcc -v
# 升級gcc到5.3及以上,如下:
升級到gcc 9.3:
yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
scl enable devtoolset-9 bash
需要注意的是scl命令啟用只是臨時的,退出shell或重啟就會恢復原系統gcc版本。
如果要長期使用gcc 9.3的話:
 
echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile
這樣退出shell重新開啟就是新版的gcc了
以下其他版本同理,修改devtoolset版本號即可

原文借鑑:
https://www.cnblogs.com/blackBlog/p/12924891.html