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

Unable to connect to Redis Datasource via Grafana Cloud #294

Open
TheOldMan2000 opened this issue Apr 26, 2023 · 3 comments
Open

Unable to connect to Redis Datasource via Grafana Cloud #294

TheOldMan2000 opened this issue Apr 26, 2023 · 3 comments

Comments

@TheOldMan2000
Copy link

Summary

Hello! Unable to connect to any of my Redis 7 instance pools on my VPS either by localhost ports or via Unix socket. Any help appreciated!

Relevant information

I have a small 48 core 6GB CentoOS 7/Virtuozzo WHM/Cpanel based cloud VPS with several small Redis Server v7.0.10 instances, each is fully working that I use for my various Apache vhosts/websites.

Each instance or pool runs under SystemD and binds to 127.0.0.0.1, they are currently un-passworded and are available via port and Unix sockets:

  • localhost:6379

  • localhost:6380

  • localhost:6381

  • … to

  • localhost:6386

  • /var/lib/redis/redis.sock

  • /var/lib/redis/redis2.sock

  • /var/lib/redis/redis3.sock

  • … to

  • /var/lib/redis/redis8.sock

I have installed the 3 related Redis plugins on my free Grafana Cloud:

  • Redis Datasource redis-datasource (v2.1.1)
  • Redis Application redis-app (v2.2.1)
  • Redis Explorer redis-explorer-app (v2.1.1)

When trying to connect to any instance via either localhost:6379 or redis://localhost:6379 etc, I get this error message via the Datasource Standalone tab:

getInstance error: dial tcp 127.0.0.1:6379: connect: connection refused

image

If I try the Unix socket connection method, I get this on the Datasource Socket tab:

getInstance error: dial unix /var/lib/redis/redis.sock: connect: no such file or directory

I can’t find any similar messages in my Apache or CSF/LFD firewall logs related to it.

I have ACL user names created (one for Grafana to eventually use) but all currently set as nopass so I’m leaving the ACL option disabled and not entering any usernames or passwords.

However when I try using the other Redis infrastructure plugin v0.0.3, that comes with the Redis Dashboard for Prometheus Redis Exporter 1.x it works fine and connects immediately. However that one doesn’t support multiple instances so it’s not ideal.

image

(BTW, the links to the demo Dashboard on the Datasource overview page are broken, I get a message saying Dashboard not found).

Many thanks!

redis-cli -s /var/lib/redis/redis.sock
redis /var/lib/redis/redis.sock> info
# Server
redis_version:7.0.10
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:5aad47f03c937350
redis_mode:standalone
os:Linux 3.10.0-1160.53.1.vz7.185.3 x86_64
arch_bits:64
monotonic_clock:POSIX clock_gettime
multiplexing_api:epoll
atomicvar_api:c11-builtin
gcc_version:8.3.1
process_id:21033
process_supervised:systemd
run_id:2ef8b39e737fa80e0b60f1e9fdb6e97bec8a04dd
tcp_port:6379
server_time_usec:1682515275648506
uptime_in_seconds:419166
uptime_in_days:4
hz:10
configured_hz:10
lru_clock:4793675
executable:/usr/bin/redis-server
config_file:/etc/redis/redis.conf
io_threads_active:0

# Clients
connected_clients:1
cluster_connections:0
maxclients:1000
client_recent_max_input_buffer:8
client_recent_max_output_buffer:0
blocked_clients:0
tracking_clients:0
clients_in_timeout_table:0

# Memory
used_memory:690744
used_memory_human:674.55K
used_memory_rss:9777152
used_memory_rss_human:9.32M
used_memory_peak:1199184
used_memory_peak_human:1.14M
used_memory_peak_perc:57.60%
used_memory_overhead:394768
used_memory_startup:392784
used_memory_dataset:295976
used_memory_dataset_perc:99.33%
allocator_allocated:903392
allocator_active:1323008
allocator_resident:10326016
total_system_memory:6442450944
total_system_memory_human:6.00G
used_memory_lua:31744
used_memory_vm_eval:31744
used_memory_lua_human:31.00K
used_memory_scripts_eval:0
number_of_cached_scripts:0
number_of_functions:0
number_of_libraries:0
used_memory_vm_functions:32768
used_memory_vm_total:64512
used_memory_vm_total_human:63.00K
used_memory_functions:184
used_memory_scripts:184
used_memory_scripts_human:184B
maxmemory:16777216
maxmemory_human:16.00M
maxmemory_policy:allkeys-lru
allocator_frag_ratio:1.46
allocator_frag_bytes:419616
allocator_rss_ratio:7.80
allocator_rss_bytes:9003008
rss_overhead_ratio:0.95
rss_overhead_bytes:-548864
mem_fragmentation_ratio:14.63
mem_fragmentation_bytes:9108704
mem_not_counted_for_evict:0
mem_replication_backlog:0
mem_total_replication_buffers:0
mem_clients_slaves:0
mem_clients_normal:1800
mem_cluster_links:0
mem_aof_buffer:0
mem_allocator:jemalloc-5.2.1
active_defrag_running:0
lazyfree_pending_objects:0
lazyfreed_objects:0

# Persistence
loading:0
async_loading:0
current_cow_peak:0
current_cow_size:0
current_cow_size_age:0
current_fork_perc:0.00
current_save_keys_processed:0
current_save_keys_total:0
rdb_changes_since_last_save:0
rdb_bgsave_in_progress:0
rdb_last_save_time:1682096109
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:-1
rdb_current_bgsave_time_sec:-1
rdb_saves:0
rdb_last_cow_size:0
rdb_last_load_keys_expired:2420
rdb_last_load_keys_loaded:0
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_rewrites:0
aof_rewrites_consecutive_failures:0
aof_last_write_status:ok
aof_last_cow_size:0
module_fork_in_progress:0
module_fork_last_cow_size:0

# Stats
total_connections_received:8544
total_commands_processed:21556
instantaneous_ops_per_sec:0
total_net_input_bytes:908396
total_net_output_bytes:38403251
total_net_repl_input_bytes:0
total_net_repl_output_bytes:0
instantaneous_input_kbps:0.00
instantaneous_output_kbps:0.00
instantaneous_input_repl_kbps:0.00
instantaneous_output_repl_kbps:0.00
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:0
expired_stale_perc:0.00
expired_time_cap_reached_count:0
expire_cycle_cpu_milliseconds:14440
evicted_keys:0
evicted_clients:0
total_eviction_exceeded_time:0
current_eviction_exceeded_time:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
pubsubshard_channels:0
latest_fork_usec:0
total_forks:0
migrate_cached_sockets:0
slave_expires_tracked_keys:0
active_defrag_hits:0
active_defrag_misses:0
active_defrag_key_hits:0
active_defrag_key_misses:0
total_active_defrag_time:0
current_active_defrag_time:0
tracking_total_keys:0
tracking_total_items:0
tracking_total_prefixes:0
unexpected_error_replies:0
total_error_replies:894
dump_payload_sanitizations:0
total_reads_processed:30100
total_writes_processed:21560
io_threaded_reads_processed:0
io_threaded_writes_processed:0
reply_buffer_shrinks:285
reply_buffer_expands:2

# Replication
role:master
connected_slaves:0
master_failover_state:no-failover
master_replid:23ca5cb3a45af59f0241225f80ae086b36ba4814
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:241104
second_repl_offset:-1
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0

# CPU
used_cpu_sys:171.736551
used_cpu_user:381.038902
used_cpu_sys_children:0.000000
used_cpu_user_children:0.000000
used_cpu_sys_main_thread:171.732740
used_cpu_user_main_thread:381.037618

# Modules

# Errorstats
errorstat_ERR:count=894

# Cluster
cluster_enabled:0

# Keyspace
redis /var/lib/redis/redis.sock>
@slorello89
Copy link
Contributor

Hi @TheOldMan2000 - I'm taking over maintenance of this plugin - so forgive me if I'm missing some critical context here.

This sounds like your trying to connect to your Redis instance (on your 48 core 6GB Centos machines) from your Grafana cloud account.

I might be missing something here, but I don't think your VPS and your free grafana instance are going to run on the same machine. So trying to connect via localhost:6379/127.0.0.1:6379 (or for that matter a unix socket) simply isn't going to work. Now if you installed Grafana on your VPS and ran it from there, sure that should work as they would be on the same server. But as it stands you would need either a DNS name or IP address that the plugin can reach out to in order to connect to Redis.

@TheOldMan2000
Copy link
Author

Hello @slorello89

Thank you for the suggestions. I’m unsure but I assumed it would work because Grafana Agent was running on the same VPS, and I have no problem at all with the other Redis plugin for Grafana Cloud, as seen in the image above.

@slorello89
Copy link
Contributor

Hi @TheOldMan2000 - Sorry for the delayed response, I looked into it wrt the grafana agent, I don't see any indication that the Grafana Agent can use this plugin (unless I'm dramatically wrong about something - if so please feel free to correct me), so you would need to use the external-IP/hostname for your Redis instance from Grafana Cloud in order to access it. Accessing Redis on localhost:6379 from Grafana Cloud will not work since it's not there.

Connect to the real host/ip and make sure your firewall is opened up and it should just work.

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