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

Connecting to the FalkorDB cluster #26

Open
QAQ-yang opened this issue Mar 15, 2024 · 2 comments
Open

Connecting to the FalkorDB cluster #26

QAQ-yang opened this issue Mar 15, 2024 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@QAQ-yang
Copy link

Hi, I've built a FalkorDB cluster and I want to test it, but there doesn't seem to be a way to connect to the cluster here.

@gkorland gkorland added the enhancement New feature or request label Apr 18, 2024
@gkorland
Copy link
Contributor

@QAQ-yang thanks it is planned to be added in the next version

@gkorland gkorland added the good first issue Good for newcomers label Apr 18, 2024
Copy link

patched-codes bot commented Oct 18, 2024

Title: Implement FalkorDB Cluster Connection Functionality

Description:
The current implementation of our FalkorDB Java client does not support connecting to a FalkorDB cluster. This limitation prevents users from leveraging the full potential of FalkorDB's distributed architecture and scalability features. Implementing cluster connection functionality is crucial for improving our client's capabilities and meeting user expectations.

Technical Specifications and Requirements:

  1. Update the Driver interface and DriverImpl class to support cluster connection parameters:

    • Add methods to accept multiple host:port combinations
    • Implement connection pooling for multiple nodes
    • Add support for cluster-aware command routing
  2. Modify the Graph interface and its implementations to handle cluster-specific operations:

    • Implement logic to distribute queries across cluster nodes
    • Add support for read/write splitting if applicable
    • Implement retry and failover mechanisms for cluster operations
  3. Update the GraphContextGenerator interface to support cluster-aware context creation

  4. Modify existing classes like GraphPipeline and GraphTransaction to be cluster-aware

  5. Implement new cluster-specific classes if necessary (e.g., ClusterTopologyManager, ClusterConnectionPool)

  6. Update all relevant test classes to include cluster connection scenarios

  7. Ensure backward compatibility with single-node connections

  8. Update documentation to reflect new cluster connection capabilities

Proposed Solution:

  1. Extend the Driver interface to include cluster-specific methods:

    public interface Driver extends AutoCloseable {
        // Existing methods...
        
        // New cluster-specific methods
        Graph graph(String graphId, ClusterConfig clusterConfig);
        ClusterTopologyManager getClusterTopologyManager();
    }
  2. Create a new ClusterConfig class to encapsulate cluster connection parameters:

    public class ClusterConfig {
        private List<HostAndPort> nodes;
        private int connectTimeout;
        private int readTimeout;
        // Add other relevant cluster configuration options
    }
  3. Implement a ClusterTopologyManager to handle node discovery and connection management:

    public class ClusterTopologyManager {
        public List<HostAndPort> getClusterNodes();
        public void refreshTopology();
        // Add other methods for managing cluster topology
    }
  4. Update DriverImpl to support cluster connections:

    public class DriverImpl implements Driver {
        private ClusterConnectionPool connectionPool;
        private ClusterTopologyManager topologyManager;
        
        public DriverImpl(ClusterConfig clusterConfig) {
            this.topologyManager = new ClusterTopologyManager(clusterConfig);
            this.connectionPool = new ClusterConnectionPool(topologyManager);
        }
        
        // Implement other methods...
    }
  5. Modify GraphImpl and other relevant classes to utilize the cluster-aware connection pool and implement cluster-specific logic.

  6. Update test classes to cover cluster scenarios, including node failures, topology changes, and distributed queries.

Action Items:

  1. Create new interfaces and classes for cluster support (ClusterConfig, ClusterTopologyManager, ClusterConnectionPool)
  2. Modify existing interfaces and classes to incorporate cluster functionality
  3. Implement cluster-aware query routing and execution logic
  4. Develop comprehensive test suite for cluster operations
  5. Update documentation to include cluster connection instructions and best practices
  6. Perform thorough testing on various cluster configurations
  7. Create examples demonstrating cluster usage for the README and documentation
  8. Update the project's pom.xml file if new dependencies are required for cluster support

By implementing these changes, we will enable our users to fully utilize FalkorDB's clustering capabilities, significantly enhancing the scalability and reliability of their graph database operations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants