How do I sync a subset of tables between two databases on the same mysql database server The...

Does a dangling wire really electrocute me if I'm standing in water?

Time travel alters history but people keep saying nothing's changed

Why is the maximum length of OpenWrt’s root password 8 characters?

Can't find the latex code for the ⍎ (down tack jot) symbol

Why could you hear an Amstrad CPC working?

Unbreakable Formation vs. Cry of the Carnarium

Does it makes sense to buy a new cycle to learn riding?

How was Skylab's orbit inclination chosen?

How to manage monthly salary

Does light intensity oscillate really fast since it is a wave?

Which Sci-Fi work first showed weapon of galactic-scale mass destruction?

Spanish for "widget"

What are the motivations for publishing new editions of an existing textbook, beyond new discoveries in a field?

"To split hairs" vs "To be pedantic"

Access elements in std::string where positon of string is greater than its size

Springs with some finite mass

What is the use of option -o in the useradd command?

It's possible to achieve negative score?

Where to refill my bottle in India?

Output the Arecibo Message

Can distinct morphisms between curves induce the same morphism on singular cohomology?

Is there a name of the flying bionic bird?

What is this 4-propeller plane?

Why can Shazam do this?



How do I sync a subset of tables between two databases on the same mysql database server



The 2019 Stack Overflow Developer Survey Results Are InHow to drop all tables in a MySQL database without dropping the database?Sync mysql databases to master serverSharing the MySQL databases between two serversAdding tables on the master - mysql database replicationHow to sync two MySQL tables (on demand or via cron)How do I sync a subset of tables between two databases on the differnet mysql database server?why does mysql have so many more open and fragmented tables than tables in the DB?In MySql how to replicate specific tables with two different databases?syncing specific tables between two already-replicating MySQL clustersBest practices to backup mysql databases





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















would like to be able to sync a subset of tables between two mysql databases that are running on the same server. One of the databases acts as the master where inserts, updates and deletes can be made. The second database uses those same tables for read-only operations. I do not want to use federated tables to achieve this. The long term goal will be to separate the 2 databases to multiple servers, The second database that has the subset of tables as read-only may also be replicated a few times over to distribute geographically for load and performance purposes each with unqiue data.... Once that is achieved, I plan to use binlog to replicate those specific tables on the secondary databases. In the meantime, I'd like to keep these tables in sync. Is there a more elegant way to do this than other than using a cronjob and mysqldump?










share|improve this question














bumped to the homepage by Community 19 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















    0















    would like to be able to sync a subset of tables between two mysql databases that are running on the same server. One of the databases acts as the master where inserts, updates and deletes can be made. The second database uses those same tables for read-only operations. I do not want to use federated tables to achieve this. The long term goal will be to separate the 2 databases to multiple servers, The second database that has the subset of tables as read-only may also be replicated a few times over to distribute geographically for load and performance purposes each with unqiue data.... Once that is achieved, I plan to use binlog to replicate those specific tables on the secondary databases. In the meantime, I'd like to keep these tables in sync. Is there a more elegant way to do this than other than using a cronjob and mysqldump?










    share|improve this question














    bumped to the homepage by Community 19 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      0












      0








      0


      0






      would like to be able to sync a subset of tables between two mysql databases that are running on the same server. One of the databases acts as the master where inserts, updates and deletes can be made. The second database uses those same tables for read-only operations. I do not want to use federated tables to achieve this. The long term goal will be to separate the 2 databases to multiple servers, The second database that has the subset of tables as read-only may also be replicated a few times over to distribute geographically for load and performance purposes each with unqiue data.... Once that is achieved, I plan to use binlog to replicate those specific tables on the secondary databases. In the meantime, I'd like to keep these tables in sync. Is there a more elegant way to do this than other than using a cronjob and mysqldump?










      share|improve this question














      would like to be able to sync a subset of tables between two mysql databases that are running on the same server. One of the databases acts as the master where inserts, updates and deletes can be made. The second database uses those same tables for read-only operations. I do not want to use federated tables to achieve this. The long term goal will be to separate the 2 databases to multiple servers, The second database that has the subset of tables as read-only may also be replicated a few times over to distribute geographically for load and performance purposes each with unqiue data.... Once that is achieved, I plan to use binlog to replicate those specific tables on the secondary databases. In the meantime, I'd like to keep these tables in sync. Is there a more elegant way to do this than other than using a cronjob and mysqldump?







      mysql database mysql-replication






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jun 25 '10 at 23:19







      user46857












      bumped to the homepage by Community 19 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 19 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          2 Answers
          2






          active

          oldest

          votes


















          0














          Depending on if your version MySQL 5.1+ I would suggestion Replication. Especially considering the fact that you plan to have a cluster down the road.






          share|improve this answer
























          • can you replicate within the same server, the documentation i've been reading seems to imply that you can't. I've never done replication before, so this is all new to me

            – user46857
            Jun 25 '10 at 23:30



















          0














          If your end goal is to separate the servers then I would suggest running a separate instance on a different port and using standard replicaton between the two



          quick google turns out this



          alternatively you can use triggers to replicate, something along the lines of



          CREATE TRIGGER replicatetable AFTER INSERT ON db1.table
          FOR EACH ROW BEGIN
          INSERT INTO db2.table(field1,field2, ...) values (db1.table.field1,db1.table.field2, ...);
          END;


          similar for UPDATE and DELETE






          share|improve this answer
























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "2"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f154995%2fhow-do-i-sync-a-subset-of-tables-between-two-databases-on-the-same-mysql-databas%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown
























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Depending on if your version MySQL 5.1+ I would suggestion Replication. Especially considering the fact that you plan to have a cluster down the road.






            share|improve this answer
























            • can you replicate within the same server, the documentation i've been reading seems to imply that you can't. I've never done replication before, so this is all new to me

              – user46857
              Jun 25 '10 at 23:30
















            0














            Depending on if your version MySQL 5.1+ I would suggestion Replication. Especially considering the fact that you plan to have a cluster down the road.






            share|improve this answer
























            • can you replicate within the same server, the documentation i've been reading seems to imply that you can't. I've never done replication before, so this is all new to me

              – user46857
              Jun 25 '10 at 23:30














            0












            0








            0







            Depending on if your version MySQL 5.1+ I would suggestion Replication. Especially considering the fact that you plan to have a cluster down the road.






            share|improve this answer













            Depending on if your version MySQL 5.1+ I would suggestion Replication. Especially considering the fact that you plan to have a cluster down the road.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jun 25 '10 at 23:19









            Jason McCrearyJason McCreary

            3111313




            3111313













            • can you replicate within the same server, the documentation i've been reading seems to imply that you can't. I've never done replication before, so this is all new to me

              – user46857
              Jun 25 '10 at 23:30



















            • can you replicate within the same server, the documentation i've been reading seems to imply that you can't. I've never done replication before, so this is all new to me

              – user46857
              Jun 25 '10 at 23:30

















            can you replicate within the same server, the documentation i've been reading seems to imply that you can't. I've never done replication before, so this is all new to me

            – user46857
            Jun 25 '10 at 23:30





            can you replicate within the same server, the documentation i've been reading seems to imply that you can't. I've never done replication before, so this is all new to me

            – user46857
            Jun 25 '10 at 23:30













            0














            If your end goal is to separate the servers then I would suggest running a separate instance on a different port and using standard replicaton between the two



            quick google turns out this



            alternatively you can use triggers to replicate, something along the lines of



            CREATE TRIGGER replicatetable AFTER INSERT ON db1.table
            FOR EACH ROW BEGIN
            INSERT INTO db2.table(field1,field2, ...) values (db1.table.field1,db1.table.field2, ...);
            END;


            similar for UPDATE and DELETE






            share|improve this answer




























              0














              If your end goal is to separate the servers then I would suggest running a separate instance on a different port and using standard replicaton between the two



              quick google turns out this



              alternatively you can use triggers to replicate, something along the lines of



              CREATE TRIGGER replicatetable AFTER INSERT ON db1.table
              FOR EACH ROW BEGIN
              INSERT INTO db2.table(field1,field2, ...) values (db1.table.field1,db1.table.field2, ...);
              END;


              similar for UPDATE and DELETE






              share|improve this answer


























                0












                0








                0







                If your end goal is to separate the servers then I would suggest running a separate instance on a different port and using standard replicaton between the two



                quick google turns out this



                alternatively you can use triggers to replicate, something along the lines of



                CREATE TRIGGER replicatetable AFTER INSERT ON db1.table
                FOR EACH ROW BEGIN
                INSERT INTO db2.table(field1,field2, ...) values (db1.table.field1,db1.table.field2, ...);
                END;


                similar for UPDATE and DELETE






                share|improve this answer













                If your end goal is to separate the servers then I would suggest running a separate instance on a different port and using standard replicaton between the two



                quick google turns out this



                alternatively you can use triggers to replicate, something along the lines of



                CREATE TRIGGER replicatetable AFTER INSERT ON db1.table
                FOR EACH ROW BEGIN
                INSERT INTO db2.table(field1,field2, ...) values (db1.table.field1,db1.table.field2, ...);
                END;


                similar for UPDATE and DELETE







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jun 26 '10 at 20:41









                Aleksandar IvanisevicAleksandar Ivanisevic

                3,1121423




                3,1121423






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Server Fault!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f154995%2fhow-do-i-sync-a-subset-of-tables-between-two-databases-on-the-same-mysql-databas%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Фонтен-ла-Гаярд Зміст Демографія | Економіка | Посилання |...

                    Список ссавців Італії Природоохоронні статуси | Список |...

                    Маріан Котлеба Зміст Життєпис | Політичні погляди |...