Comments (8)
@zuiderkwast I suppose the client always knows whether it's connecting to a standalone or a cluster. Your suggestion sounds great to me, in any case!
from ered.
@zuiderkwast is it possible to connect to a standalone node, with PR #41 ?
from ered.
Even without #41, it's possible to connect to a single node using the ered_client
module. #41 does make things a little more clear though with functions like ered:connect_client for connecting to a single instance.
It's not possible to use a standalone instance as if it were a cluster though, with the same functions, but actually I don't think we want to do this automatically. Cluster and standalone deployments are very different. Standalone mode allows SELECT and cross-slot commands, for example, which are forbidden in cluster mode.
from ered.
@zuiderkwast Thanks a lot for your useful information! Currently we're using eredis in VerneMQ so we cannot connect to a Redis cluster yet. And ered's stated goal is to replace both previous libraries, isn't it. In any case, I'll try to do some testing based on your suggestions.
from ered.
Yes, ered implements the functionality for single instance and cluster, but the API has a preference for cluster. This was done before I was the maintainer of this project. Now, I've been trying to make the API look nice for single instance too.
An idea: We use a tuple like {cluster, Pid}
or {standalone, Pid}
as the ered instance reference, returned by ered:connect
functions. Then we can use the same functions like ered:command/N
for both of them and it can dispatch to the right module based on the tuple. That's future work, if you like the idea. (ssl:connect
and gen_tcp:connect
return tuples like this, so it's not that strange.)
I've been busy with other work though.
from ered.
I've now written my plugin using ered:start_link/2
as main entry point. As expected, this only works for a cluster, not a standalone (standalone gets the unmapped_slots
error). A question, though: with the idea proposed above, will ered
be able to figure out by itself whether it connects to a standalone or a cluster?
from ered.
A question, though: with the idea proposed above, will
ered
be able to figure out by itself whether it connects to a standalone or a cluster?
It would be possible to auto-detect, but I think it's better that users connect explicitly to cluster or standalone. I'm thinking ered:connect(Host, Port, Opts)
for standalone and ered:connect_cluster(AddressesAndPorts, Opts)
for cluster. After that, ered:command(EredRef, Command)
and similar can be used for both kinds of instances.
from ered.
Sounds great. That interface is perfect at least for me, as the client (the plugin) always knows whether it connects to a cluster or not.
Let me know if I can test (or do anything helpful). No worry & no hurry for anyone :)
I think it'll be a cool library to use and like the unified approach in it.
from ered.
Related Issues (11)
- Add supervision tree
- Don't use blocking recv HOT 5
- Pub/sub support
- AUTH support
- Avoid copying between processes HOT 5
- Handling of redirects in pipelines
- Adopt Secure Software Development Best Practices of OpenSSF Scorecard HOT 2
- Keep init-nodes as fallback if all nodes fail HOT 4
- Check that cluster has converged before reporting 'cluster_ok'
- README.md lacks usage description HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ered.