Manually create / insert data to Cassandra Docker












1















I am using Cassandra with Docker. The point is I have an external keyspace definition (with its own proper tables and data storage there) in other host and I wanted to import data from that host's Cassandra into my docker Cassandra one.




  • Host Cassandra version is: [cqlsh 5.0.1 | Cassandra 3.11.2 | CQL spec
    3.4.4 | Native protocol v4]

  • My Docker Cassandra version is: [cqlsh 5.0.1 | Cassandra 3.11.3 | CQL spec 3.4.4 | Native protocol v4]


So because I think this is not a compatibility issue, I followed these steps:





  1. Exported keyspace definition using



    cqlsh -e 'describe mykeyspac' > mykeyspace.cql



  2. Went to external host and then created a snapshot of the keyspace data using:



    scp myuser@host:/var/lib/cassandra/data/mykeyspace/home/myuserid/docker-data/mykeyspace


    (don't mind about this code, the point is that I downloaded a full copy of the data to my local computer).



  3. Mount this volume into docker cassandra in the docker-compose.yaml file


  4. Started Docker


  5. Connected to Docker using



    docker exec -it container-id bash


    and checked that the volume is correctly mounted.



  6. Using cqlsh created the new keyspace with a , no problem at all.



Then using cqlsh checked that keyspace is correctly created and tables and other definitions are there. But doing a simple SELECT query results in 0 rows, but the data is physically there under



/var/lib/cassandra/data/mykeyspace 


inside the Cassandra Docker.

So, what's the problem here?

Can anyone help me?










share|improve this question





























    1















    I am using Cassandra with Docker. The point is I have an external keyspace definition (with its own proper tables and data storage there) in other host and I wanted to import data from that host's Cassandra into my docker Cassandra one.




    • Host Cassandra version is: [cqlsh 5.0.1 | Cassandra 3.11.2 | CQL spec
      3.4.4 | Native protocol v4]

    • My Docker Cassandra version is: [cqlsh 5.0.1 | Cassandra 3.11.3 | CQL spec 3.4.4 | Native protocol v4]


    So because I think this is not a compatibility issue, I followed these steps:





    1. Exported keyspace definition using



      cqlsh -e 'describe mykeyspac' > mykeyspace.cql



    2. Went to external host and then created a snapshot of the keyspace data using:



      scp myuser@host:/var/lib/cassandra/data/mykeyspace/home/myuserid/docker-data/mykeyspace


      (don't mind about this code, the point is that I downloaded a full copy of the data to my local computer).



    3. Mount this volume into docker cassandra in the docker-compose.yaml file


    4. Started Docker


    5. Connected to Docker using



      docker exec -it container-id bash


      and checked that the volume is correctly mounted.



    6. Using cqlsh created the new keyspace with a , no problem at all.



    Then using cqlsh checked that keyspace is correctly created and tables and other definitions are there. But doing a simple SELECT query results in 0 rows, but the data is physically there under



    /var/lib/cassandra/data/mykeyspace 


    inside the Cassandra Docker.

    So, what's the problem here?

    Can anyone help me?










    share|improve this question



























      1












      1








      1








      I am using Cassandra with Docker. The point is I have an external keyspace definition (with its own proper tables and data storage there) in other host and I wanted to import data from that host's Cassandra into my docker Cassandra one.




      • Host Cassandra version is: [cqlsh 5.0.1 | Cassandra 3.11.2 | CQL spec
        3.4.4 | Native protocol v4]

      • My Docker Cassandra version is: [cqlsh 5.0.1 | Cassandra 3.11.3 | CQL spec 3.4.4 | Native protocol v4]


      So because I think this is not a compatibility issue, I followed these steps:





      1. Exported keyspace definition using



        cqlsh -e 'describe mykeyspac' > mykeyspace.cql



      2. Went to external host and then created a snapshot of the keyspace data using:



        scp myuser@host:/var/lib/cassandra/data/mykeyspace/home/myuserid/docker-data/mykeyspace


        (don't mind about this code, the point is that I downloaded a full copy of the data to my local computer).



      3. Mount this volume into docker cassandra in the docker-compose.yaml file


      4. Started Docker


      5. Connected to Docker using



        docker exec -it container-id bash


        and checked that the volume is correctly mounted.



      6. Using cqlsh created the new keyspace with a , no problem at all.



      Then using cqlsh checked that keyspace is correctly created and tables and other definitions are there. But doing a simple SELECT query results in 0 rows, but the data is physically there under



      /var/lib/cassandra/data/mykeyspace 


      inside the Cassandra Docker.

      So, what's the problem here?

      Can anyone help me?










      share|improve this question
















      I am using Cassandra with Docker. The point is I have an external keyspace definition (with its own proper tables and data storage there) in other host and I wanted to import data from that host's Cassandra into my docker Cassandra one.




      • Host Cassandra version is: [cqlsh 5.0.1 | Cassandra 3.11.2 | CQL spec
        3.4.4 | Native protocol v4]

      • My Docker Cassandra version is: [cqlsh 5.0.1 | Cassandra 3.11.3 | CQL spec 3.4.4 | Native protocol v4]


      So because I think this is not a compatibility issue, I followed these steps:





      1. Exported keyspace definition using



        cqlsh -e 'describe mykeyspac' > mykeyspace.cql



      2. Went to external host and then created a snapshot of the keyspace data using:



        scp myuser@host:/var/lib/cassandra/data/mykeyspace/home/myuserid/docker-data/mykeyspace


        (don't mind about this code, the point is that I downloaded a full copy of the data to my local computer).



      3. Mount this volume into docker cassandra in the docker-compose.yaml file


      4. Started Docker


      5. Connected to Docker using



        docker exec -it container-id bash


        and checked that the volume is correctly mounted.



      6. Using cqlsh created the new keyspace with a , no problem at all.



      Then using cqlsh checked that keyspace is correctly created and tables and other definitions are there. But doing a simple SELECT query results in 0 rows, but the data is physically there under



      /var/lib/cassandra/data/mykeyspace 


      inside the Cassandra Docker.

      So, what's the problem here?

      Can anyone help me?







      backup docker






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 25 at 20:15









      zx485

      995913




      995913










      asked Jan 25 at 13:46









      George de LemosGeorge de Lemos

      62




      62






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          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%2fsuperuser.com%2fquestions%2f1398371%2fmanually-create-insert-data-to-cassandra-docker%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • 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%2fsuperuser.com%2fquestions%2f1398371%2fmanually-create-insert-data-to-cassandra-docker%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

          Plaza Victoria

          Puebla de Zaragoza

          Musa