ray: [core] External Redis does not work for new clusters
What is the problem?
Ray 1.5.0
See https://discuss.ray.io/t/how-can-i-connect-to-pre-created-redis-instance/3048/2
Related PR:
https://github.com/ray-project/ray/pull/13170
Reproduction (REQUIRED)
Start and run redis on Mac OS
brew install redis
# configure /usr/local/etc/redis.conf - e.g. bind to 0.0.0.0 and set `protected-mode no`
brew services start redis
Python:
import ray
ray.init(address="127.0.0.1:6379", _redis_password="")
Output after 60s:
RuntimeError Traceback (most recent call last)
in
----> 1 ray.init(address=“10.216.188.132:6379”, _redis_password=“password=”)
/opt/conda/envs/ACQAPython/lib/python3.6/site-packages/ray/_private/client_mode_hook.py in wrapper(*args, **kwargs)
80 if client_mode_should_convert():
81 return getattr(ray, func.name)(*args, **kwargs)
—> 82 return func(*args, **kwargs)
83
84 return wrapper
/opt/conda/envs/ACQAPython/lib/python3.6/site-packages/ray/worker.py in init(address, num_cpus, num_gpus, resources, object_store_memory, local_mode, ignore_reinit_error, include_dashboard, dashboard_host, dashboard_port, job_config, configure_logging, logging_level, logging_format, log_to_driver, namespace, runtime_env, internal_config, _enable_object_reconstruction, _redis_max_memory, _plasma_directory, _node_ip_address, _driver_object_store_memory, _memory, _redis_password, _temp_dir, _lru_evict, _metrics_export_port, _system_config, _tracing_startup_hook, **kwargs)
907 shutdown_at_exit=False,
908 spawn_reaper=False,
→ 909 connect_only=True)
910
911 if driver_mode == SCRIPT_MODE and job_config:
/opt/conda/envs/ACQAPython/lib/python3.6/site-packages/ray/node.py in init(self, ray_params, head, shutdown_at_exit, spawn_reaper, connect_only)
179 else:
180 redis_client = self.create_redis_client()
→ 181 session_name = _get_with_retry(redis_client, “session_name”)
182 self.session_name = ray._private.utils.decode(session_name)
183
/opt/conda/envs/ACQAPython/lib/python3.6/site-packages/ray/node.py in _get_with_retry(redis_client, key, num_retries)
46 time.sleep(2)
47 if not result:
—> 48 raise RuntimeError(f"Could not read ‘{key}’ from GCS (redis). "
49 “Has redis started correctly on the head node?”)
50 return result
RuntimeError: Could not read ‘session_name’ from GCS (redis). Has redis started correctly on the head node?
Workaround: Start ray first using cli with ray start --head --address=127.0.0.1:6379 --redis-password ""
cc @wuisawesome
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 23 (17 by maintainers)
@WangTaoTheTonic I assume item3 and item4 will do the same thing according to documentation (https://docs.ray.io/en/master/package-ref.html?#ray.init)? Correct me if I am wrong.
Yeah I agree that adding prefix exposes underlying implementation details to users. I thought ray.init will do exactly same thing with ray start, so I was trying to resolve the conflicts that how ray.init handles passing in Redis address.
By re-reading the docs, I finally find my self wrong - ray.init will never create a ray cluster but only processes. This implementation is fine to me, then.
Thank a lot