LoginSignup
1
1

More than 3 years have passed since last update.

Redisインストール ( Mac Rails VScode)

Last updated at Posted at 2019-10-14

今回は人から貰ったRedisを使用したWebアプリを
私のローカル環境で見れるようにしたいので、
Redisをインストールします。
Redis公式サイトはこちら

Redisとは

超高速データベース
部分的に使われる
リアルタイムランキングなどに使用される

インストール

まずはRedisのインストール

$brew install redis
インストール完了
==> Downloading from https://akamai.bintray.com/1c/1cf97b4ba2f47029f76979b430c76c760ce467786d85907031a86b58fd4b4960?__gda__=exp=1571060074~hmac=4f9428de0396e8
######################################################################## 100.0%
==> Pouring redis-5.0.6.mojave.bottle.tar.gz
==> Caveats
To have launchd start redis now and restart at login:
  brew services start redis
Or, if you don't want/need a background service you can just run:
  redis-server /usr/local/etc/redis.conf
==> Summary
🍺  /usr/local/Cellar/redis/5.0.6: 13 files, 3.1MB
バージョン確認方法
$redis-server --version
Redis server v=5.0.6 sha=00000000:0 malloc=libc bits=64 build=7a57e483d6f8b275

起動

貰ったディレクトリを開いて
$bin/rails db:migratebundle installをして

puma起動
$bin/rails s

※railsサーバー起動用と、Redis起動用の2つターミナル使いました。新しいターミナル追加するボタンを押してターミナル2つにしてください。(一番下にスクショ)

Redis起動
$redis-server
55517:C 14 Oct 2019 22:44:35.927 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
55517:C 14 Oct 2019 22:44:35.928 # Redis version=5.0.6, bits=64, commit=00000000, modified=0, pid=55517, just started
55517:C 14 Oct 2019 22:44:35.928 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 5.0.6 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 55517
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

55517:M 14 Oct 2019 22:44:35.945 # Server initialized
55517:M 14 Oct 2019 22:44:35.946 * Ready to accept connections

* Ready to accept connectionsと出ているのでRedis起動OK

これでローカルでWebアプリが見ることができます。

終了

終了する時はpumaとredisそれぞれCtrl+Cで終了してください。
(Redisの終了の仕方は、他の方法もあるようですが、今回はCtrl+Cで簡単に終了する方法をとりました。)

ターミナル追加ボタン VScode

ターミナル追加.png

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1