Coder Social home page Coder Social logo

Comments (3)

poundifdef avatar poundifdef commented on May 18, 2024 1

Sure.

from scratchdata.

amrullahfarook avatar amrullahfarook commented on May 18, 2024

Hey there @poundifdef! I came across Scratch DB and was interested in contributing, can I take up this issue?

from scratchdata.

poundifdef avatar poundifdef commented on May 18, 2024

I think there need to be 2 data structures: one users and servers.

The users data structure looks like this:

{
  "users": [
    {"api_key": "A","cluster": "A"},
    {"api_key": "B","cluster": "B"}
   ]
}

The servers structure would look like this:

{
  "servers": {
    "1.1.1.1": [
      {"cluster": "A", "shard": "A1"},
      {"cluster": "B", "shard": "B1"}
    ],
    "2.2.2.2": [
      {"cluster": "A", "shard": "A2"},
      {"cluster": "B", "shard": "B1"}
    ]
  }
}

Now we have a correlation between a user and their cluster with the users.cluster.

The servers structure should be able to directly translate to a clickhouse cluster XML config. For example, the above would translate to:

<clickhouse>
    <remote_servers>
        <A>
            <shard>
            <!-- shard A1 -->
                <replica>
                    <host>1.1.1.1</host>
                </replica>
            </shard>
            <shard>
            <!-- shard A2 -->
                <replica>
                    <host>2.2.2.2</host>
                </replica>
            </shard>
        </A>
        <B>
            <shard>
                <!-- shard B1, 2 replicas -->
                <replica>
                    <host>1.1.1.1</host>
                </replica>
                <replica>
                    <host>2.2.2.2</host>
                </replica>
            </shard>
        </B>
    </remote_servers>
</clickhouse>

I would also be open to the inverse - having the config store data which mirrors the Clickhouse required config, and using that to translate to figure out which clusters are hosted on which servers.

At the end of this project, we should be able to do the following:

  1. Ensure that we are performing database options on the correct cluster depending on which API key was used
  2. Write algorithms to choose which individual shard or replica to write data to

from scratchdata.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.