Permalink
Browse files

updated redis-proxy

  • Loading branch information...
1 parent 93a5941 commit 26a04c1c77eba4cc0c111b167ef27ad7e8e57b7c Mike committed Nov 8, 2010
Showing with 26 additions and 6 deletions.
  1. +13 −4 lib/config-node-client.js
  2. +13 −2 proxy-node/redis-proxy
View
17 lib/config-node-client.js
@@ -5,9 +5,18 @@ var ConfigNodeClient = exports.ConfigNodeClient = function( addr, port ) {
self.ipAddress = addr
self.port = port
- this.getDataNodes = function( callback ) {
- //lookup data nodes from redis instance
- var nodes = ['localhost:88888']
- callback( null, nodes )
+ this.getDataNodeInfo = function( callback ) {
+ //TODO: lookup data nodes from redis instance
+
+ //hard coded for now, to work through redis-proxy
+ var info = {
+ 1: {
+ host: 'localhost',
+ port: 8900,
+ slots: [0,4095]
+ }
+ }
+
+ callback( null, info )
}
}
View
15 proxy-node/redis-proxy
@@ -29,14 +29,25 @@ if( Math.ceil(bitsf) != bitsf ) {
var HASH_BITS = bitsf
+//query config server for full list of data nodes and establish connections to each
+//prior to accepting connections
var configSvr = new ConfigClient( 'localhost', 8000 )
-configSvr.getDataNodes( function(err, nodes) {
+
+configSvr.getDataNodeInfo( function(err, dataNodeInfos) {
+ //if there was an error listing data nodes
if( err ) {
sys.puts( 'ERROR - unable to lookup data nodes from config server, error was: ' + err )
process.exit(-1)
}
- initialize()
+ for( var id in dataNodeInfos ) {
+ var info = dataNodeInfo[id]
+ sys.puts( 'connecting to data node ' + id + ', ' + info.host + ':' + info.port )
+
+ }
+
+ //start accepting connections
+ startServer()
})

0 comments on commit 26a04c1

Please sign in to comment.