peter.bocian

peter.bocian

Redix problem connecting mix to redis

Hi Elixir team! I am new to this forum. I currently moved to redis sentinel and although production is working fine I am having trouble getting my tests to pass. The error I am seeing is: ** (Mix) Could not start application scrivener: Scrivener.start(:normal, []) returned an error: shutdown: failed to start child: :worker ** (EXIT) an exception was raised: ** (MatchError) no match of right hand side value: {:error, {:EXIT, {%ArgumentError{message: "sentinel address should be specified as a URI or a keyword list, got: nil"}, [{Redix.StartOptions, :normalize_sentinel_address, 2, [file: 'lib/redix/start_options.ex', line: 122]}, {Enum, :"-map/2-lists^map/1-0-", 2, [file: 'lib/enum.ex', line: 1411]}, {Redix.StartOptions, :sanitize_sentinel_opts, 1, [file: 'lib/redix/start_options.ex', line: 79]}, {Redix.StartOptions, :maybe_sanitize_sentinel_opts, 1, [file: 'lib/redix/start_options.ex', line: 68]}, {Redix.StartOptions, :sanitize, 1, [file: 'lib/redix/start_options.ex', line: 51]}, {Redix.Connection, :start_link, 1, [file: 'lib/redix/connection.ex', line: 25]}, {:supervisor, :do_start_child_i, 3, [file: 'supervisor.erl', line: 385]}, {:supervisor, :handle_call, 3, [file: 'supervisor.erl', line: 410]}]}}} (poolboy 1.5.1) src/poolboy.erl:275: :poolboy.new_worker/1 . My test.exs is set up exactly like my prod.exs => ```config :scrivener, Scrivener.Endpoint,
http: [:inet6, port: {:system, “PORT”}],
server: false

Do not print debug messages in production

config :logger, level: :warn

Pull Redis sentinel settings from environment variables

{ redis_pool_size, original_value } = (System.get_env(“REDIS_POOL_SIZE”) || “5”) |> Integer.parse
{ redis_max_overflow, original_value } = (System.get_env(“REDIS_MAX_OVERFLOW”) || “2”) |> Integer.parse
{ redis_sentinel_timeout, original_value } = (System.get_env(“REDIS_SENTINEL_TIMEOUT”) || “10000”) |> Integer.parse

config :redix,
pool_size: redis_pool_size,
max_overflow: redis_max_overflow,
sentinel: [
sentinels: [
System.get_env(“REDIS_SENTINEL_HOST_A”),
System.get_env(“REDIS_SENTINEL_HOST_B”),
System.get_env(“REDIS_SENTINEL_HOST_C”)
],
group: System.get_env(“REDIS_SENTINEL_GROUP”),
timeout: redis_sentinel_timeout
]```. I can see it is a redix issue but not sure how to resolve.

Most Liked

al2o3cr

al2o3cr

I suspect one of these environment variables isn’t set, that would explain finding a nil in sentinels

al2o3cr

al2o3cr

Try inspecting the values in the config; something is not making it to Redix.

config :redix,
  pool_size: redis_pool_size,
  max_overflow: redis_max_overflow,
  sentinel: [
    sentinels: [
      System.get_env(“REDIS_SENTINEL_HOST_A”),
      System.get_env(“REDIS_SENTINEL_HOST_B”),
      System.get_env(“REDIS_SENTINEL_HOST_C”)
    ] |> IO.inspect(label: "sentinel list"),
    group: System.get_env(“REDIS_SENTINEL_GROUP”),
    timeout: redis_sentinel_timeout
  ]
peter.bocian

peter.bocian

Thank you :bowing_man:. It looks like when printing they were coming in as null. I hardcoded redis sentinel endpoints and following error: {%ArgumentError{message: “a host should be specified for each sentinel”}. When looking in redix docs, I see {Redix supports Redis Sentinel by passing a :sentinel
option to start_link/1 (or start_link/2) instead of :host and :port.}. Which is how it looks like I set it up.

Where Next?

Popular in Questions Top

shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
pgiesin
This should be a simple problem but I just can’t seem to figure it out. I have a standalone Elixir app that won’t find the database. Dep...
New
tduccuong
Hi, is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
polypush135
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
Mooodi
Given a string, how can I get access to its character by index? Enum.at("my_string", 2) doesn't work. Or rather, not char, but a substr...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
magnetic
Hey :wave:t3: Elixir community, I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New

We're in Beta

About us Mission Statement