Tag Archives: Redis Error

How to Solve Redis Error: /bin/sh: cc: command not found

 

[root@hadoop01 redis-3.0.0]# make
cd src && make all
make[1]: Entering directory `/usr/local/redis-3.0.0/src'
rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-dump redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html
(cd ../deps && make distclean)
make[2]: Entering directory `/usr/local/redis-3.0.0/deps'
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
make[2]: Leaving directory `/usr/local/redis-3.0.0/deps'
(rm -f .make-*)
echo STD=-std=c99 -pedantic >> .make-settings
echo WARN=-Wall -W >> .make-settings
echo OPT=-O2 >> .make-settings
echo MALLOC=jemalloc >> .make-settings
echo CFLAGS= >> .make-settings
echo LDFLAGS= >> .make-settings
echo REDIS_CFLAGS= >> .make-settings
echo REDIS_LDFLAGS= >> .make-settings
echo PREV_FINAL_CFLAGS=-std=c99 -pedantic -Wall -W -O2 -g -ggdb   -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -DUSE_JEMALLOC -I../deps/jemalloc/include >> .make-settings
echo PREV_FINAL_LDFLAGS=  -g -ggdb -rdynamic >> .make-settings
(cd ../deps && make hiredis linenoise lua jemalloc)
make[2]: Entering directory `/usr/local/redis-3.0.0/deps'
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
(echo "" > .make-ldflags)
(echo "" > .make-cflags)
MAKE hiredis
cd hiredis && make static
make[3]: Entering directory `/usr/local/redis-3.0.0/deps/hiredis'
gcc -std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb  net.c
make[3]: gcc:command cannot found
make[3]: *** [net.o] error 127
make[3]: Leaving directory `/usr/local/redis-3.0.0/deps/hiredis'
make[2]: *** [hiredis] error 2
make[2]: Leaving directory `/usr/local/redis-3.0.0/deps'
make[1]: [persist-settings] error 2 (igorne)
    CC adlist.o
/bin/sh: cc: command not found
make[1]: *** [adlist.o] error 127
make[1]: Leaving directory `/usr/local/redis-3.0.0/src'
make: *** [all] error 2

prompt GCC and CC command not found

Solutions

yum -y install gcc gcc-c++ libstdc++-devel

How to Solve Redis Error: OOM command not allowed when used memory > ‘maxmemory’

exception prompt: the memory is full and no more data can be saved. You can view the specific information of redis through redis cli

127.0.0.1:6379> info memory
# Memory
used_memory:168363320
used_memory_human:160.56M
used_memory_rss:150208512
used_memory_rss_human:143.25M
used_memory_peak:168425144
used_memory_peak_human:160.62M
used_memory_peak_perc:99.96%
used_memory_overhead:139522822
used_memory_startup:487096
used_memory_dataset:28840498
used_memory_dataset_perc:17.18%
total_system_memory:4143534080
total_system_memory_human:3.86G
used_memory_lua:37888
used_memory_lua_human:37.00K
maxmemory:124000000
maxmemory_human:118.26M
maxmemory_policy:noeviction
mem_fragmentation_ratio:0.89
mem_allocator:jemalloc-4.0.3
active_defrag_running:0
lazyfree_pending_objects:0

used_ memory_ Human represents used memory

used_ memory_ RSS represents the memory allocated by the system to redis (i.e. resident memory)

mem_ fragmentation_ ratio=used_ memory_ rss/used_ Memory ratio, in general, used_ memory_ RSS is slightly higher than used_ Memory, when there are many memory fragments, then memory_ fragmentation_ The ratio will be large, which can reflect whether there are many memory fragments

solutions:

1. Add redis memory and modify redis.conf

maxmemory 2gb

2. Modify the redis storage policy

The default redis setting is very conservative, that is, it will not be stored after memory overrun. You can change the policy to LRU algorithm (the least recently used algorithm) – the new stored information will replace the old information, so that the memory will not cross the line and redis.conf will not be modified

maxmemory-policy volatile-lru

3. Save unnecessary data in redis

After modifying the configuration, you must restart redis to take effect