Git Product home page Git Product logo

Comments (17)

SergejJurecko avatar SergejJurecko commented on June 12, 2024

Yes adding nodes/clusters can be done without downtime.

Nodes are divided into clusters. A cluster is a replication unit. If you start out with a single node, then you most likely should add 2 nodes to the existing group. If you wish to expand further, create a new group.

To add a node to an existing group named grp1 (actordb on that node should be running)

use config
insert into nodes values ('[email protected]','grp1');
commit

To create a new cluster:

use config
insert into groups values ('grp3','cluster');
insert into nodes values ('[email protected]','grp3');
insert into nodes values ('[email protected]','grp3');
insert into nodes values ('[email protected]','grp3');
commit

This is documented at: http://www.actordb.com/docs-configuration.html

from actordb.

tom-adsfund avatar tom-adsfund commented on June 12, 2024

Very interesting!

When you add an actor, is it allocated to a cluster, and then stays within that cluster?
Can we remove nodes online using SQL to remove them from the 'nodes' table? (So maybe remove bad hardware, or scale down hardware.)
I guess that we can't remove clusters/groups once they are made?

from actordb.

SergejJurecko avatar SergejJurecko commented on June 12, 2024

Yes the actor stays in the cluster. Unless you add clusters, then it might get moved to a new one.

You do not need to remove nodes when changing hardware. Steps to change nodes:

  1. Create a copy of the lmdb file from an existing node using actordb_tool (backup option).
  2. Turn off one of the nodes
  3. Setup new hardware or upgrade
  4. Configure actordb on it normally, copy lmdb file to /var/actordb/lmdb (or wherever you have it configured)
  5. Start actordb on that node
  6. Connect actordb_console to an active node and run
    use config
    UPDATE nodes SET name='newname@newip' WHERE name='oldname@oldip'

Step 6 is not required if you use the same name and ip as the old hardware.

We support deleting nodes from clusters, but not deleting clusters (yet).

from actordb.

tom-adsfund avatar tom-adsfund commented on June 12, 2024

Sounds good.

When you say 'might get moved', is that automatic?

from actordb.

SergejJurecko avatar SergejJurecko commented on June 12, 2024

Yes it is automatic. Every actor belongs to a shard. When adding new clusters, existing shards get split in half. A new node will take the top half of the shard from an existing node in another cluster. So if the actor is in the top half of such a shard, it will get moved.

from actordb.

tom-adsfund avatar tom-adsfund commented on June 12, 2024

I guess that during that update, the actors will be locked (preventing writes until the shards have been transferred), and if there is a failure it will recover?

(Sorry for all the questions! This is a very clever project.)

from actordb.

SergejJurecko avatar SergejJurecko commented on June 12, 2024

No problem ask away.

Actors are moved relatively slowly. One at a time generally. Actor data is split into two parts. The main block (basically an sqlite file inside lmdb), and the write-ahead-log. Main block can be copied over while executing reads and writes. Once it gets to the WAL, the actor is locked. If there were a lot of writes since start of copy WAL will be larger and it will take longer.

from actordb.

tom-adsfund avatar tom-adsfund commented on June 12, 2024

That's a smart way to minimize locking time. I guess that if there's a failure during the lock, the WAL will still be on at least one side, and so it will be easy to recover? Is the movement restarted automatically if a failed node comes back online?

from actordb.

SergejJurecko avatar SergejJurecko commented on June 12, 2024

Yes copy is restarted if it fails at any time (during lock or no).

from actordb.

tom-adsfund avatar tom-adsfund commented on June 12, 2024

Great.

What would be the SQL for a transaction transferring an amount from a balance in one actor to a balance in another actor?

from actordb.

SergejJurecko avatar SergejJurecko commented on June 12, 2024

If balance actor has a table that stores the value and a transaction log. It would look something like this:

actor balance(b1);
update balancetable set b=b-Amount where id=X;
insert into log (id,user,amount) values (TransID,u1,X);
actor user(u1);
update usertable set b=b+Amount where id=X;

A transaction log table is required somewhere. It can be in balance, user or a specific log actor (depending on your use case). Mostly because a transaction may succeed, but a client may loose connectivity before getting a successful response.

from actordb.

tom-adsfund avatar tom-adsfund commented on June 12, 2024

Excellent. Thanks for all your time. I'll come back if there's anything else. Great work on what seems like a very solid distributed system.

from actordb.

federico-razzoli avatar federico-razzoli commented on June 12, 2024

Hello. I have questions related to the ones that I read here, and I can't find a mailing list, so I'll write them here.

  1. What are minimum and maximum sizes for a cluster?
  2. If a 1-node cluster is allowed, can I disconnect it from the others, add data to a single actor (no multi-actor transactions) and then reconnect it?
  3. What filesystem(s) do you recommend for nodes?

Thanks in advance.

from actordb.

SergejJurecko avatar SergejJurecko commented on June 12, 2024
  1. 1 - 5
  2. Theoretically yes it should work.
  3. If performance is of critical importance, ext2 will actually perform best. Because it does not do journaling. Otherwise I would stick to ext3/ext4.

from actordb.

federico-razzoli avatar federico-razzoli commented on June 12, 2024

Thank you for your answers. The project is definitely interesting.

I have another doubt. I got this watning on startup:
!!!! WARNING: ulimit -n is 1024; 32768 is the recommended minimum.

It is not a problem itself. But while reading documentation, I didn't realize that ActorDB opens so many files. Perhaps the documentation should explain what files are used, and how they are used.

Or am I missing something?

from actordb.

SergejJurecko avatar SergejJurecko commented on June 12, 2024

System default is ridiculously low. ActorDB used to use a lot more files, it no longer does so because everything is in the lmdb file. But every client connection is also a file descriptor and counts as an open file. We kept the warning because one should increase that limit. Unless you are running a small setup that will only use a few connections. In that case ignore the warning.

from actordb.

federico-razzoli avatar federico-razzoli commented on June 12, 2024

I agree that the default is too low. I asked just because I never seen that warning with other databases.

Thanks for the clarification.

from actordb.

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.