Apa Itu Redis
Redis adalah server cache dan penyimpanan data key-value open source berlisensi BSD. Redis sering juga disebut sebagai server struktur data karena dapat menampung strings, hashes, lists, sorted sets, bitmaps dan hyperloglogs. Anda bisa mendapatkan informasi lebih lanjut mengenai Redis dari situs web redis di redis.io
Instalasi Redis di Mac OS X Menggunakan brew
Apabila anda sudah menginstall brew sebelumnya anda bisa melakukan instalasi redis dengan menggunakan perintah berikut :
$ brew install redis
Instalasi Redis di MacOS X tanpa brew
Apabila anda belum memiliki brew atau ingin mengkompilasi sendiri redis, anda bisa mengunduh Redis dari situs Redis. Saat tulisan ini dibuat versi stabil terbaru adalah redis-2.8.19. Anda bisa menggunakan command curl dibawah ini untuk mengunduh versi terbaru Redis, saya akan mengunduh di folder Download didalam home directory saya
$ cd ~/Downloads $ curl -o redis-2.8.19.tar.gz http://download.redis.io/releases/redis-2.8.19.tar.gz
Setelah proses mengunduh Redis selesai anda bisa mengekstrak file terkompres yang baru saja anda unduh dan mulai mengkompilasi. Saya berasumsi bahwa anda sudah melakukan instalasi XCode atau compiler lain di computer anda.
$ tar xzvf redis-2.8.19.tar.gz $ cd redis-2.8.19 $ make test ... The End Execution time of different units: 0 seconds - unit/printver 1 seconds - unit/quit 3 seconds - unit/auth 3 seconds - unit/scan 3 seconds - unit/multi 7 seconds - unit/protocol 12 seconds - unit/expire 23 seconds - unit/type/list 15 seconds - integration/aof 6 seconds - integration/rdb 2 seconds - unit/pubsub 4 seconds - integration/convert-zipmap-hash-on-load 2 seconds - unit/slowlog 43 seconds - unit/type/list-2 1 seconds - unit/introspection 45 seconds - unit/type/hash 14 seconds - unit/scripting 2 seconds - unit/limits 48 seconds - unit/aofrw 85 seconds - unit/type/zset 85 seconds - unit/type/list-3 85 seconds - unit/type/set 41 seconds - unit/dump 86 seconds - unit/sort 86 seconds - unit/other 86 seconds - unit/basic 53 seconds - unit/maxmemory 108 seconds - integration/replication-2 67 seconds - unit/obuf-limits 69 seconds - unit/memefficiency 111 seconds - integration/replication-psync 35 seconds - unit/hyperloglog 81 seconds - unit/bitops 131 seconds - integration/replication 132 seconds - integration/replication-3 134 seconds - integration/replication-4 \o/ All tests passed without errors! Cleanup: may take some time... OK
Mengkopi binari redis dan redis-cli
$ sudo mv src/redis-server /usr/bin $ sudo mv src/redis-cli /usr/bin
Sekarang anda bisa menjalankan redis dengan menggunakan perintah berikut :
$ redis-server
Anda akan mendapatkan pesan error kurang lebih sebagai berikut :
[89427] 02 Mar 12:51:17.181 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
Tekan CTRL+C untuk mematikan redis-server. Untuk menghilangkan pesan error diatas kita akan mengkopi file konfigurasi redis.conf bawaan source code redis dan kita akan jalankan ulang redis
$ mkdir ~/.redis/ $ cp redis.conf ~/.redis/
Jalankan ulang redis dengan perintah
$ redis-server ~/.redis/redis.conf [89597] 02 Mar 13:18:58.438 * Increased maximum number of open files to 10032 (it was originally set to 256). <em>.</em> <em>.-<code>__ ''-._ _.-</code> <code>.</code></em>. ''-._ Redis 2.8.19 (00000000/0) 64 bit .-<code>.-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in stand alone mode |`-._`-...-` __...-.</code>-.<em>|'<code>_.-'| Port: 6379 |</code>-.</em> <code>._ / _.-' | PID: 89597</code>-._ <code>-._</code>-./ <em>.-' _.-' |<code>-._</code>-.</em> <code>-.__.-' _.-'_.-'| |</code>-.<em><code>-._ _.-'_.-' | http://redis.io</code>-.</em> <code>-._</code>-.<strong>.-'<em>.-' _.-' |<code>-._</code>-.</em> <code>-.__.-' _.-'_.-'| |</code>-.<em><code>-._ _.-'_.-' |</code>-.</em> <code>-._</code>-.</strong>.-'_.-' _.-' <code>-._</code>-.<strong>.-' _.-' <code>-._ _.-'</code>-.</strong>.-' [89597] 02 Mar 13:18:58.440 # Server started, Redis version 2.8.19 [89597] 02 Mar 13:18:58.467 * DB loaded from disk: 0.028 seconds [89597] 02 Mar 13:18:58.468 * The server is now ready to accept connections on port 6379
Anda telah berhasil melakukan instalasi redis di MacOS X. Di artikel selanjutnya kita akan belajar untuk mengakses redis menggunakan redis-cli. Tabik.