How to add a node to an mnesia cluster?
2011-11-17 10:32
344 查看
转载:http://stackoverflow.com/questions/787755/how-to-add-a-node-to-an-mnesia-cluster
Start your new node (
On your original node (
To make new the node
This command may take a while to execute as it will copy the contents of each table over the network.
Start your new node (
b@node)
erl -sname b -mnesia dir '"/path/to/storage"' -s mnesia. This starts a new ram_copes node called
b@node.
On your original node (
a@node), at the erlang prompt execute
mnesia:change_config(extra_db_nodes, ['b@node']).This will cause the original node to connect
bto the mnesia cluster. At this point,
b@nodehas joined the cluster but only has a copy of the schema.
To make new the node
b@nodecapable of storing disc copies, we need to change the schema table type on
b@nodefrom
ram_copiesto
disc_copies. Run
mnesia:change_table_copy_type(schema, 'b@node', disc_copies).on any node.
b@nodeonly has a copy of the schema at this point. To copy all the tables from
a@nodeto
b@nodeand maintain table types, you can run:
[{Tb, mnesia:add_table_copy(Tb, node(), Type)} || {Tb, [{'a@node', Type}]} <- [{T, mnesia:table_info(T, where_to_commit)} || T <- mnesia:system_info(tables)]].
This command may take a while to execute as it will copy the contents of each table over the network.
b@nodeis now an exact replica of
a@node. You could modify that statement - replace the
Typevariable with
disc_only_copiesin the call to
mnesia:add_table_copy/3in order to copy the tables but ensure they're on disc only.
相关文章推荐
- How to set an Apache Kafka multi node – multi broker cluster【z】
- [Kerberos] How to Kerberize an Hadoop Cluster
- nopCommerce : Updating an existing entity. How to add a new property.
- How To Install Node.js on an Ubuntu 14.04 server
- How To Add MFC Support to an ATL Project
- How to add the selinux policy access for the new created linux file node.
- How To Add a New Disk(s) to An Existing Diskgroup on RAC (Best Practices).
- How can I add properties to an object at runtime?
- How to hide an entry in the Add/Remove Programs applet?
- How to add an image on reportViewer (rdlc)
- How to change to an older version of node.js
- How to add an editable checkbox at JFace TableViewer
- How to Add An Automatically Executable Program in YOCTO?
- How to Add the JVM Component to an Existing Oracle Database (Doc ID 1461562.1)
- How to add Chinese support to an English only BB emulator
- 1、How to add an access-allowed ACE to a file
- [eZ publish] How to add a element to an array.
- How to Create a Node.js Cluster for Speeding Up Your Apps
- How to Build an High Availability MQTT Cluster for the Internet of Things
- drupal7之学习在已存在的form表单中增加自定义验证(Learn how to add custom validation to an existing Drupal form)