[英]aws codebuild / using local redis (ubuntu image)
進入代碼構建; 目前希望在本地 ubuntu 圖像上使用 redis;
使用以下腳本:
version: 0.2
phases:
install:
commands:
- apt update
- apt install -y redis-server wget
pre_build:
commands:
- wget https://raw.githubusercontent.com/Hronom/wait-for-redis/master/wait-for-redis.sh
- chmod +x ./wait-for-redis.sh
- service redis-server start
- ./wait-for-redis.sh localhost:6379
build:
commands:
- redis-cli info
- redis-cli info server
目前在我們看來,最終不需要 docker-compose,我們將首先考慮以這種方式使用它——期待標准的 ubuntu 行為。
我們正在使用類似的方法安裝 postgres,它確實可以正常啟動並且完全可用。
在這里我們無法正常啟動 redis, wait-for-redis不斷重試(不斷出現錯誤Could not connect to Redis at localhost:6379: Connection refused
)
使用 ec2 linux 映像(基於 yum),我們沒有這樣的問題
在 ubuntu 上下文中啟動 redis 的正確方法是什么?
剛剛遇到了同樣的問題。
當我將cat /var/log/redis/*.log
添加到構建規范時,我發現 Redis 無法綁定:
Creating Server TCP listening socket ::1:6379: bind: Cannot assign requested address
進一步的研究表明這是一個已知問題: https://github.com/redis/redis/issues/3241
...可以通過將這些行添加到構建規范來修復(在使用 redis 之前):
- sed -i '/^bind/s/bind.*/bind 127.0.0.1/' /etc/redis/redis.conf
- service redis-server restart
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.