Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I get this error when trying locally: Slot refresh error. #5

Open
KabDeveloper opened this issue Jul 17, 2019 · 8 comments
Open

I get this error when trying locally: Slot refresh error. #5

KabDeveloper opened this issue Jul 17, 2019 · 8 comments

Comments

@KabDeveloper
Copy link

Hi,

For test, I am using one redis server only on Windows.

When I launch a test, I am getting this error message:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error(Some("Slot refresh error."))', src\libcore\result.rs:999:5
stack backtrace:
   0: std::sys_common::backtrace::_print
             at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c\/src\libstd\sys_common\backtrace.rs:71
   1: std::panicking::default_hook::{{closure}}
             at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c\/src\libstd\panicking.rs:197
   2: std::panicking::default_hook
             at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c\/src\libstd\panicking.rs:211
   3: std::panicking::rust_panic_with_hook
             at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c\/src\libstd\panicking.rs:474
   4: std::panicking::continue_panic_fmt
             at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c\/src\libstd\panicking.rs:381
   5: std::panicking::rust_begin_panic
             at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c\/src\libstd\panicking.rs:308
   6: core::panicking::panic_fmt
             at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c\/src\libcore\panicking.rs:85
   7: core::result::unwrap_failed<r2d2::Error>
             at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c\src\libcore\macros.rs:18
   8: core::result::Result<r2d2::Pool<r2d2_redis_cluster::RedisClusterConnectionManager>, r2d2::Error>::unwrap<r2d2::Pool<r2d2_redis_cluster::RedisClusterConnectionManager>,r2d2::Error>
             at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c\src\libcore\result.rs:800
   9: test::main
             at .\src\main.rs:97
  10: std::rt::lang_start::{{closure}}<core::result::Result<(), std::io::error::Error>>
             at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c\src\libstd\rt.rs:64
  11: std::panicking::try::do_call<closure,i32>
             at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c\/src\libstd\panicking.rs:293
  12: panic_unwind::__rust_maybe_catch_panic
             at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c\/src\libpanic_unwind\lib.rs:85
  13: std::rt::lang_start_internal
             at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c\/src\libstd\rt.rs:48
  14: std::rt::lang_start<core::result::Result<(), std::io::error::Error>>
             at /rustc/a53f9df32fbb0b5f4382caaad8f1a46f36ea887c\src\libstd\rt.rs:64
  15: main
  16: __scrt_common_main_seh
             at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283
  17: BaseThreadInitThunk
  18: RtlUserThreadStart
error: process didn't exit successfully: `target\debug\test.exe` (exit code: 101)

Using the example code in the readme:

extern crate r2d2_redis_cluster;

use std::thread;

use r2d2_redis_cluster::{r2d2::Pool, Commands, RedisClusterConnectionManager};

fn main() {
    let redis_uri = vec!["redis://127.0.0.1:6379"];
    let manager = RedisClusterConnectionManager::new(redis_uri).unwrap();
    let pool = Pool::builder()
        .build(manager)
        .unwrap();

    let mut handles = Vec::new();

    for _ in 0..10 {
        let pool = pool.clone();
        handles.push(thread::spawn(move || {
            let connection = pool.get().unwrap();
            let n: u64 = connection.incr("test", 1).unwrap();
        }));
    }

    for h in handles {
        h.join().unwrap();
    }

    let connection = pool.get().unwrap();
    let res: u64 = connection.get("test").unwrap();

    assert_eq!(res, 10);
}

Please help to get it running !

@atuk721
Copy link
Owner

atuk721 commented Jul 17, 2019

Redis cluster needs at least three master nodes.
Please confirm below.

https://redis.io/topics/cluster-tutorial

Note that the minimal cluster that works as expected requires to contain at least three master nodes.

@KabDeveloper
Copy link
Author

@atuk721 Why not adding support for both: Redis alone + Cluster ?

I can't find a good tutorial for Windows, will try and let you know.

@KabDeveloper
Copy link
Author

@atuk721 I created a Redis Cluster on my computer: 2 Slave + 1 Master

But still getting the same error message :(

How to solve it please ? Thank you

@atuk721
Copy link
Owner

atuk721 commented Jul 20, 2019

@bcashier
I think you don't have right Redis cluster configuration.
Please run the following command, then confirm slots data are returned.

redis-cli cluster slots

I think you didn't execute "redis-cli --cluster create" command of bellow after start Redis cluster.

https://redis.io/topics/cluster-tutorial

@atuk721
Copy link
Owner

atuk721 commented Jul 20, 2019

@bcashier
If you don't need using Redis cluster, use below.

https://github.com/mitsuhiko/redis-rs
https://github.com/sorccu/r2d2-redis

@KabDeveloper
Copy link
Author

@atuk721
I need to use Redis Cluster for my project unfortunatelly.

It seem that this working on Linux but not on Windows.

I will use https://github.com/sorccu/r2d2-redis for test, and then switch to urs when releasing the app.

@atuk721
Copy link
Owner

atuk721 commented Jul 21, 2019

@bcashier

It seem that this working on Linux but not on Windows.

I don't think so.
You said to create cluster of "2 Slave + 1 Master", but Redis cluster needs "3 Master".
"Cluster" and "Replication" are not same.
This library is only for cluster now.

If you mean to need cluster, please show me a result to execute below command.

redis-cli cluster slots

If blank is returned, it doesn't set to configure Redis cluster.

@KabDeveloper
Copy link
Author

@atuk721 When I launch that command, I receive this error message:

(error) ERR This instance has cluster support disabled

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants