redis-server 2-6.17 seems correctly installed but Error 111 connecting localhost:6379. Connection refused

4,122 views
Skip to first unread message

Marco Ippolito

unread,
Jan 21, 2014, 8:49:22 AM1/21/14
to redi...@googlegroups.com
Hi all,
I downloaded and installed in my Ubuntu 12.04 micro instance redis-server 2-6.17.
Apparently the installation and compilation went fine but when running a python file with redis commands it says: 
"
python RedisUse.py
Traceback (most recent call last):
  File "RedisUse.py", line 24, in <module>
    print r_server.set('foo', 'bar')
  File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 897, in set
    return self.execute_command('SET', *pieces)
  File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 464, in execute_command
    connection.send_command(*args)
  File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 329, in send_command
    self.send_packed_command(self.pack_command(*args))
  File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 311, in send_packed_command
    self.connect()
  File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 253, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting localhost:6379. Connection refused.
"
What do you suggest me to do?
Follows what I did in order to compile and test the source code.

Marco


/usr/bin/redis-2.6.17]$make
cd src && make all
make[1]: Entering directory `/usr/bin/redis-2.6.17/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/bin/redis-2.6.17/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/bin/redis-2.6.17/deps'
(rm -f .make-*)
echo STD=-std=c99 -pedantic >> .make-settings
echo WARN=-Wall >> .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 -O2 -g -rdynamic -ggdb   -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -DUSE_JEMALLOC -I../deps/jemalloc/include >> .make-settings
echo PREV_FINAL_LDFLAGS=  -g -rdynamic -ggdb >> .make-settings
(cd ../deps && make hiredis linenoise lua jemalloc)
make[2]: Entering directory `/usr/bin/redis-2.6.17/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/bin/redis-2.6.17/deps/hiredis'
cc -std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb  net.c
cc -std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb  hiredis.c
cc -std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb  sds.c
cc -std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb  async.c
ar rcs libhiredis.a net.o hiredis.o sds.o async.o
make[3]: Leaving directory `/usr/bin/redis-2.6.17/deps/hiredis'
MAKE linenoise
cd linenoise && make
make[3]: Entering directory `/usr/bin/redis-2.6.17/deps/linenoise'
cc  -Wall -Os -g  -c linenoise.c
make[3]: Leaving directory `/usr/bin/redis-2.6.17/deps/linenoise'
MAKE lua
cd lua/src && make all CFLAGS="-O2 -Wall -DLUA_ANSI " MYLDFLAGS=""
make[3]: Entering directory `/usr/bin/redis-2.6.17/deps/lua/src'
gcc -O2 -Wall -DLUA_ANSI    -c -o lapi.o lapi.c
gcc -O2 -Wall -DLUA_ANSI    -c -o lcode.o lcode.c
gcc -O2 -Wall -DLUA_ANSI    -c -o ldebug.o ldebug.c
gcc -O2 -Wall -DLUA_ANSI    -c -o ldo.o ldo.c
gcc -O2 -Wall -DLUA_ANSI    -c -o ldump.o ldump.c
gcc -O2 -Wall -DLUA_ANSI    -c -o lfunc.o lfunc.c
gcc -O2 -Wall -DLUA_ANSI    -c -o lgc.o lgc.c
gcc -O2 -Wall -DLUA_ANSI    -c -o llex.o llex.c
gcc -O2 -Wall -DLUA_ANSI    -c -o lmem.o lmem.c
gcc -O2 -Wall -DLUA_ANSI    -c -o lobject.o lobject.c
gcc -O2 -Wall -DLUA_ANSI    -c -o lopcodes.o lopcodes.c
gcc -O2 -Wall -DLUA_ANSI    -c -o lparser.o lparser.c
gcc -O2 -Wall -DLUA_ANSI    -c -o lstate.o lstate.c
gcc -O2 -Wall -DLUA_ANSI    -c -o lstring.o lstring.c
gcc -O2 -Wall -DLUA_ANSI    -c -o ltable.o ltable.c
gcc -O2 -Wall -DLUA_ANSI    -c -o ltm.o ltm.c
gcc -O2 -Wall -DLUA_ANSI    -c -o lundump.o lundump.c
gcc -O2 -Wall -DLUA_ANSI    -c -o lvm.o lvm.c
gcc -O2 -Wall -DLUA_ANSI    -c -o lzio.o lzio.c
gcc -O2 -Wall -DLUA_ANSI    -c -o strbuf.o strbuf.c
gcc -O2 -Wall -DLUA_ANSI    -c -o lauxlib.o lauxlib.c
gcc -O2 -Wall -DLUA_ANSI    -c -o lbaselib.o lbaselib.c
gcc -O2 -Wall -DLUA_ANSI    -c -o ldblib.o ldblib.c
gcc -O2 -Wall -DLUA_ANSI    -c -o liolib.o liolib.c
gcc -O2 -Wall -DLUA_ANSI    -c -o lmathlib.o lmathlib.c
gcc -O2 -Wall -DLUA_ANSI    -c -o loslib.o loslib.c
gcc -O2 -Wall -DLUA_ANSI    -c -o ltablib.o ltablib.c
gcc -O2 -Wall -DLUA_ANSI    -c -o lstrlib.o lstrlib.c
gcc -O2 -Wall -DLUA_ANSI    -c -o loadlib.o loadlib.c
gcc -O2 -Wall -DLUA_ANSI    -c -o linit.o linit.c
gcc -O2 -Wall -DLUA_ANSI    -c -o lua_cjson.o lua_cjson.c
gcc -O2 -Wall -DLUA_ANSI    -c -o lua_struct.o lua_struct.c
gcc -O2 -Wall -DLUA_ANSI    -c -o lua_cmsgpack.o lua_cmsgpack.c
lua_cmsgpack.c: In function 'table_is_an_array':
lua_cmsgpack.c:370:21: warning: variable 'max' set but not used [-Wunused-but-set-variable]
ar rcu liblua.a lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o strbuf.o lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o lstrlib.o loadlib.o linit.o lua_cjson.o lua_struct.o lua_cmsgpack.o  # DLL needs all object files
ranlib liblua.a
gcc -O2 -Wall -DLUA_ANSI    -c -o lua.o lua.c
gcc -o lua  lua.o liblua.a -lm
gcc -O2 -Wall -DLUA_ANSI    -c -o luac.o luac.c
gcc -O2 -Wall -DLUA_ANSI    -c -o print.o print.c
gcc -o luac  luac.o print.o liblua.a -lm
make[3]: Leaving directory `/usr/bin/redis-2.6.17/deps/lua/src'
MAKE jemalloc
cd jemalloc && ./configure --with-jemalloc-prefix=je_ --enable-cc-silence CFLAGS="-std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops " LDFLAGS=""
checking for xsltproc... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking size of void *... 8
checking size of int... 4
checking size of long... 8
checking size of intmax_t... 8
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking whether __asm__ syntax is compilable... yes
checking whether __attribute__ syntax is compilable... yes
checking whether compiler supports -fvisibility=hidden... yes
checking whether compiler supports -Werror... yes
checking whether tls_model attribute is compilable... no
checking for a BSD-compatible install... /usr/bin/install -c
checking for ranlib... ranlib
checking for ar... /usr/bin/ar
checking for ld... /usr/bin/ld
checking for autoconf... no
checking for memalign... yes
checking for valloc... yes
checking configured backtracing method... N/A
checking for sbrk... yes
checking whether utrace(2) is compilable... no
checking whether valgrind is compilable... no
checking STATIC_PAGE_SHIFT... 12
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking for pthread_create in -lpthread... yes
checking for _malloc_thread_cleanup... no
checking for _pthread_mutex_init_calloc_cb... no
checking for TLS... yes
checking whether a program using ffsl is compilable... yes
checking whether atomic(9) is compilable... no
checking whether Darwin OSAtomic*() is compilable... no
checking whether to force 32-bit __sync_{add,sub}_and_fetch()... no
checking whether to force 64-bit __sync_{add,sub}_and_fetch()... no
checking whether Darwin OSSpin*() is compilable... no
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/html.xsl
config.status: creating doc/manpages.xsl
config.status: creating doc/jemalloc.xml
config.status: creating include/jemalloc/jemalloc.h
config.status: creating include/jemalloc/internal/jemalloc_internal.h
config.status: creating test/jemalloc_test.h
config.status: creating config.stamp
config.status: creating bin/jemalloc.sh
config.status: creating include/jemalloc/jemalloc_defs.h
config.status: executing include/jemalloc/internal/size_classes.h commands
===============================================================================
jemalloc version   : 3.2.0-0-g87499f6748ebe4817571e817e9f680ccb5bf54a9
library revision   : 1

CC                 : gcc
CPPFLAGS           :  -D_GNU_SOURCE -D_REENTRANT
CFLAGS             : -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -fvisibility=hidden
LDFLAGS            :
LIBS               :  -lm -lpthread
RPATH_EXTRA        :

XSLTPROC           :
XSLROOT            :

PREFIX             : /usr/local
BINDIR             : /usr/local/bin
INCLUDEDIR         : /usr/local/include
LIBDIR             : /usr/local/lib
DATADIR            : /usr/local/share
MANDIR             : /usr/local/share/man

srcroot            :
abs_srcroot        : /usr/bin/redis-2.6.17/deps/jemalloc/
objroot            :
abs_objroot        : /usr/bin/redis-2.6.17/deps/jemalloc/

JEMALLOC_PREFIX    : je_
JEMALLOC_PRIVATE_NAMESPACE
                   :
install_suffix     :
autogen            : 0
experimental       : 1
cc-silence         : 1
debug              : 0
stats              : 1
prof               : 0
prof-libunwind     : 0
prof-libgcc        : 0
prof-gcc           : 0
tcache             : 1
fill               : 1
utrace             : 0
valgrind           : 0
xmalloc            : 0
mremap             : 0
munmap             : 0
dss                : 0
lazy_lock          : 0
tls                : 1
===============================================================================
cd jemalloc && make CFLAGS="-std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops " LDFLAGS="" lib/libjemalloc.a
make[3]: Entering directory `/usr/bin/redis-2.6.17/deps/jemalloc'
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/jemalloc.o src/jemalloc.c
src/jemalloc.c: In function 'je_realloc':
src/jemalloc.c:1082:9: warning: variable 'old_rzsize' set but not used [-Wunused-but-set-variable]
src/jemalloc.c: In function 'je_free':
src/jemalloc.c:1230:10: warning: variable 'rzsize' set but not used [-Wunused-but-set-variable]
src/jemalloc.c: In function 'je_rallocm':
src/jemalloc.c:1477:9: warning: variable 'old_rzsize' set but not used [-Wunused-but-set-variable]
src/jemalloc.c: In function 'je_dallocm':
src/jemalloc.c:1622:9: warning: variable 'rzsize' set but not used [-Wunused-but-set-variable]
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/arena.o src/arena.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/atomic.o src/atomic.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/base.o src/base.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/bitmap.o src/bitmap.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/chunk.o src/chunk.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/chunk_dss.o src/chunk_dss.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/chunk_mmap.o src/chunk_mmap.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/ckh.o src/ckh.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/ctl.o src/ctl.c
src/ctl.c: In function 'epoch_ctl':
src/ctl.c:1112:11: warning: variable 'newval' set but not used [-Wunused-but-set-variable]
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/extent.o src/extent.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/hash.o src/hash.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/huge.o src/huge.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/mb.o src/mb.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/mutex.o src/mutex.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/prof.o src/prof.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/quarantine.o src/quarantine.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/rtree.o src/rtree.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/stats.o src/stats.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/tcache.o src/tcache.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/util.o src/util.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops  -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/tsd.o src/tsd.c
ar crus lib/libjemalloc.a src/jemalloc.o src/arena.o src/atomic.o src/base.o src/bitmap.o src/chunk.o src/chunk_dss.o src/chunk_mmap.o src/ckh.o src/ctl.o src/extent.o src/hash.o src/huge.o src/mb.o src/mutex.o src/prof.o src/quarantine.o src/rtree.o src/stats.o src/tcache.o src/util.o src/tsd.o
make[3]: Leaving directory `/usr/bin/redis-2.6.17/deps/jemalloc'
make[2]: Leaving directory `/usr/bin/redis-2.6.17/deps'
    CC adlist.o
    CC ae.o
    CC anet.o
    CC dict.o
    CC redis.o
    CC sds.o
    CC zmalloc.o
    CC lzf_c.o
    CC lzf_d.o
    CC pqsort.o
    CC zipmap.o
    CC sha1.o
    CC ziplist.o
    CC release.o
    CC networking.o
    CC util.o
    CC object.o
    CC db.o
    CC replication.o
    CC rdb.o
    CC t_string.o
    CC t_list.o
    CC t_set.o
    CC t_zset.o
    CC t_hash.o
    CC config.o
    CC aof.o
    CC pubsub.o
    CC multi.o
    CC debug.o
    CC sort.o
    CC intset.o
    CC syncio.o
    CC migrate.o
    CC endianconv.o
    CC slowlog.o
    CC scripting.o
    CC bio.o
    CC rio.o
    CC rand.o
    CC memtest.o
    CC crc64.o
    CC bitops.o
    CC sentinel.o
    LINK redis-server
    INSTALL redis-sentinel
    CC redis-cli.o
    LINK redis-cli
    CC redis-benchmark.o
    LINK redis-benchmark
    CC redis-check-dump.o
    LINK redis-check-dump
    CC redis-check-aof.o
    LINK redis-check-aof

Hint: To run 'make test' is a good idea ;)

make[1]: Leaving directory `/usr/bin/redis-2.6.17/src'

$make test
cd src && make test
make[1]: Entering directory `/usr/bin/redis-2.6.17/src'
Cleanup: may take some time... OK
Starting test server at port 11111
[ready]: 28009
Testing unit/printver
[ready]: 28010
Testing unit/auth
.....

  99 seconds - unit/obuf-limits

\o/ All tests passed without errors!

Cleanup: may take some time... OK
make[1]: Leaving directory `/usr/bin/redis-2.6.17/src'
[root@ip-172-31-15-5:/usr/bin/redis-2.6.17]$sudo make install
cd src && make install
make[1]: Entering directory `/usr/bin/redis-2.6.17/src'

Hint: To run 'make test' is a good idea ;)

mkdir -p /usr/local/bin
    INSTALL install
    INSTALL install
    INSTALL install

/usr/bin/redis-2.6.17]$redis-server redis.conf
[29895] 21 Jan 10:38:26.802 * Max number of open files set to 10032
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 2.6.17 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in stand alone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 29895
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

[29895] 21 Jan 10:38:26.803 # Server started, Redis version 2.6.17
[29895] 21 Jan 10:38:26.804 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot

/etc]$sysctl vm.overcommit_memory=1
vm.overcommit_memory = 1

]$which redis-server
/usr/local/bin/redis-server

$sudo pip install redis
Downloading/unpacking redis
  Downloading redis-2.9.0.tar.gz (314kB): 314kB downloaded
  Running setup.py egg_info for package redis

Installing collected packages: redis
  Running setup.py install for redis

Successfully installed redis
Cleaning up...


Jan-Erik Rediger

unread,
Jan 21, 2014, 8:55:08 AM1/21/14
to redi...@googlegroups.com
Did you start redis manually or by using your init system?
> --
> You received this message because you are subscribed to the Google Groups "Redis DB" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
> To post to this group, send email to redi...@googlegroups.com.
> Visit this group at http://groups.google.com/group/redis-db.
> For more options, visit https://groups.google.com/groups/opt_out.

Marco Ippolito

unread,
Jan 21, 2014, 9:19:32 AM1/21/14
to redi...@googlegroups.com
Hi Jan-Erik,

can you please explain me what do actually I have to do in order to correctly start it?

After installing and compiling the source code, I tested it (make test) and configured it.
Then I installed redis-py.

Then I just typed python RedisUse.py (which is the file with some redis command)

Is it correct? or do I have to do something else?

Kind regards.
Marco

Marco Ippolito

unread,
Jan 21, 2014, 9:26:03 AM1/21/14
to redi...@googlegroups.com
this time I tried to start redis through Python shell:

python
Python 2.7.3 (default, Sep 26 2013, 20:03:06)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import redis
>>> conn = redis.Redis()
>>> conn.set('hello', 'world')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 897, in set
    return self.execute_command('SET', *pieces)
  File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 464, in execute_command
    connection.send_command(*args)
  File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 329, in send_command
    self.send_packed_command(self.pack_command(*args))
  File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 311, in send_packed_command
    self.connect()
  File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 253, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting localhost:6379. Connection refused.
>>>

with the same result....any suggestions?
Marco

Jan-Erik Rediger

unread,
Jan 21, 2014, 9:29:51 AM1/21/14
to redi...@googlegroups.com
It seems you don't really understand what redis is and how it works.
As I don't want to repeat what's out there, please read this:
http://stackoverflow.com/questions/7888880/what-is-redis-and-what-do-i-use-it-for

Redis is a server, so you have to first start it. If you compiled it by
hand and installed it with "make install" then a init script is not
installed.
It would be better to use a already packaged version of redis, for
example from https://launchpad.net/~chris-lea/+archive/redis-server (the
version in ubuntu's repositories is pretty old).
This comes with a handy init script, after installing it
`/etc/init.d/redis-server start` will start the server after which it
can be accessed by redis-cli or your script.

If you still have problems I suggest you visit the IRC channel (#redis
at freenode).

Marco Ippolito

unread,
Jan 21, 2014, 9:31:52 AM1/21/14
to redi...@googlegroups.com
to integrate my previous mail:

tried to connect to redis-cli:

redis-cli
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected>


Marco

Marco Ippolito

unread,
Jan 21, 2014, 10:50:56 AM1/21/14
to redi...@googlegroups.com
Hi Jan-Erik,
thanks for your kind help.

Anyway....it was a problem of permissions in Ubuntu...
after installing redis 2.8 version via apt-get everything went ok.

Kind regards.
Marco
Reply all
Reply to author
Forward
0 new messages