-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Connecting to cluster example #2298
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
Connecting to cluster example #2298
Conversation
This pull request introduces 1 alert when merging 80e1c8b into d0bfa77 - view on LGTM.com new alerts:
|
Closes #2281 when merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@varadkarpe thanks for your PR, I've noted a few areas where it doesn't meet the contribution guidelines (see https://github.com/redis/node-redis/tree/master/examples#readme)
Please also add your example script to the table in the README, keeping the scripts in alphabetical order.
examples/connect-to-cluster.js
Outdated
@@ -0,0 +1,32 @@ | |||
//This is an example script to connect to a running cluster. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//This is an example script to connect to a running cluster. | |
// This is an example script to connect to a running cluster. |
examples/connect-to-cluster.js
Outdated
@@ -0,0 +1,32 @@ | |||
//This is an example script to connect to a running cluster. | |||
// After connecting to the cluster I am attempting to set and get a value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// After connecting to the cluster I am attempting to set and get a value. | |
// After connecting to the cluster the code then sets and gets a value. |
examples/connect-to-cluster.js
Outdated
//This is an example script to connect to a running cluster. | ||
// After connecting to the cluster I am attempting to set and get a value. | ||
|
||
//To setup this cluster you can follow the guide here : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//To setup this cluster you can follow the guide here : | |
// To setup this cluster you can follow the guide here: |
examples/connect-to-cluster.js
Outdated
//To setup this cluster you can follow the guide here : | ||
// https://redis.io/docs/manual/scaling/ | ||
// In this guide the ports which are being used are 7000 - 7005 | ||
//But since I am a macOS user I am using 7001 - 7006 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//But since I am a macOS user I am using 7001 - 7006 |
Removed as not needed.
examples/connect-to-cluster.js
Outdated
|
||
//To setup this cluster you can follow the guide here : | ||
// https://redis.io/docs/manual/scaling/ | ||
// In this guide the ports which are being used are 7000 - 7005 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// In this guide the ports which are being used are 7000 - 7005 |
Removed as not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I felt it was important to mention the port numbers which I am using since the master nodes in the example script are using the ports 7001 - 7003.
examples/connect-to-cluster.js
Outdated
await cluster.connect(); | ||
|
||
await cluster.set('foo', 'bar'); | ||
const value = await cluster.get('foo') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const value = await cluster.get('foo') | |
const value = await cluster.get('hello'); |
Added ;
as the guidelines for examples say to use them - see README in the examples folder.
examples/connect-to-cluster.js
Outdated
|
||
await cluster.connect(); | ||
|
||
await cluster.set('foo', 'bar'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await cluster.set('foo', 'bar'); | |
await cluster.set('hello', 'cluster'); |
Note that the guidelines in the README in the examples folder say not to use foo
and bar
examples.
examples/connect-to-cluster.js
Outdated
|
||
await cluster.set('foo', 'bar'); | ||
const value = await cluster.get('foo') | ||
console.log(value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log(value) | |
console.log(value); | |
await cluster.quit(); |
Adds missing ;
, also quits as per the example script requirements in the README.
Hey @simonprickett |
Codecov ReportBase: 95.85% // Head: 93.42% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #2298 +/- ##
==========================================
- Coverage 95.85% 93.42% -2.43%
==========================================
Files 433 433
Lines 4002 4002
Branches 451 451
==========================================
- Hits 3836 3739 -97
- Misses 102 202 +100
+ Partials 64 61 -3
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@varadkarpe thanks for your contribution. If you are a member of our Discord server (discord.gg/redis) please let us know your handle so we can give you the |
Hey @SuzeShardlow |
Thanks, I've given you the role! :) |
Adding an example to connect to an open source Redis cluster.
This issue is described in detail in :
#2281 (comment)