SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.all();Redisを知ってますか?
私は正直言って知らなかった。
RedisとはBSDでライセンスされている、オープンソースのkey-valueストアことで、簡単に言えばNoSQL。
NoSQLは過去にMongoDB、Cassandraを使った事がある。特にCassandraでスキーマの作り方とか学習したが、そんな大量データを扱う事がないので、今もって業務では使用していない。
今回は新たに、Redisを使ってみる。Redisにはkey-valueストア以外にも機能があり、Pub-Subサーバーとして使える。
今、個人的にPub-Subにハマっているので、インストールしてみる。
Mac OS Xでパッケージ管理にはhomebrewを使っていると、コマンド1行で終わる。
$brew install redis
dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid
==> Downloading http://redis.googlecode.com/files/redis-2.6.14.tar.gz
######################################################################## 100.0%
==> make -C /private/tmp/redis-t51l/redis-2.6.14/src CC=cc
==> Caveats
To have launchd start redis at login:
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
Then to load redis now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
Or, if you don’t want/need launchctl, you can just run:
redis-server /usr/local/etc/redis.conf
==> Summary
/usr/local/Cellar/redis/2.6.14: 9 files, 760K, built in 10 seconds
何事も問題なくあっさりと10秒でインストールできた。
起動は手動でやりたいので、書いてある通り
$redis-server /usr/local/etc/redis.conf
[80525] 03 Jul 16:45:20.844 * Max number of open files set to 10032
.
.-__ ''-._
_.- . . ‘’-._ Redis 2.6.14 (00000000/0) 64 bit
.-.-. / _.,_ ''-._
( ' , .-` | `, ) Running in stand alone mode
|`-._`-...-` __...-.-.|’ _.-'| Port: 6379
| -. ._ / _.-' | PID: 80525
-._ -._ -./ .-‘ _.-‘
|-._-. -.__.-' _.-'_.-'|
| -.-._ _.-'_.-' | http://redis.io
-. -._-..-‘.-‘ _.-‘
|-._-. -.__.-' _.-'_.-'|
| -.-._ _.-'_.-' |
-. -._-..-‘_.-‘ _.-‘
-._ -..-‘ _.-‘
-._ _.-'
-..-‘
[80525] 03 Jul 16:45:20.846 # Server started, Redis version 2.6.14
[80525] 03 Jul 16:45:20.846 * The server is now ready to accept connections on port 6379
いい感じで起動が完了した。
接続をしてみる。
$ redis-cli
redis 127.0.0.1:6379>
これで接続確認できた。あとは、使い方を習得しないと。