読者です 読者をやめる 読者になる 読者になる

Taker's インフラ関連技術調査ログ

インフラ関連についての調査メモです。

Ubuntuに最新版Redisをインストールする

Vagrant上に構築したUbuntu 14.04にRedisをソースからコンパイル,インストールする

ダウンロード、解凍

$ sudo apt-get update
$ sudo apt-get install gcc python-dev tcl
$ wget http://download.redis.io/releases/redis-3.0.4.tar.gz
$ tar zxvf redis-3.0.4.tar.gz

コンパイル、インストール

Virtualboxの割り当てメモリが少ないとmake testがこけるので注意

$ cd redis-3.0.4
$ make
$ make test
\o/ All tests passed without errors!

起動

$ src/redis-server
11589:C 13 Sep 08:34:15.898 # Warning: no config file specified, using the default config. In order to specify a config file use src/redis-server /path/to/redis.conf
11589:M 13 Sep 08:34:15.899 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
11589:M 13 Sep 08:34:15.899 # Redis can't set maximum open files to 10032 because of OS error: Operation not permitted.
11589:M 13 Sep 08:34:15.899 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 3.0.4 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 11589
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

11589:M 13 Sep 08:34:15.901 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
11589:M 13 Sep 08:34:15.902 # Server started, Redis version 3.0.4
11589:M 13 Sep 08:34:15.902 # 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 or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
11589:M 13 Sep 08:34:15.902 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
11589:M 13 Sep 08:34:15.902 * The server is now ready to accept connections on port 6379

接続

$ src/redis-cli
127.0.0.1:6379> set foo bar
OK
127.0.0.1:6379> get foo
"bar"
127.0.0.1:6379> 

続き

Webチュートリアルがあるのでそれをやってみると良さそう。 Try Redis

参考

http://redis.io/download#installation

www.amazon.co.jp

/* Responsive: yes */