Manually create / insert data to Cassandra Docker
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:
Exported keyspace definition using
cqlsh -e 'describe mykeyspac' > mykeyspace.cql
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).
Mount this volume into docker cassandra in the
docker-compose.yaml
file- Started Docker
Connected to Docker using
docker exec -it container-id bash
and checked that the volume is correctly mounted.
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
add a comment |
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:
Exported keyspace definition using
cqlsh -e 'describe mykeyspac' > mykeyspace.cql
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).
Mount this volume into docker cassandra in the
docker-compose.yaml
file- Started Docker
Connected to Docker using
docker exec -it container-id bash
and checked that the volume is correctly mounted.
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
add a comment |
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:
Exported keyspace definition using
cqlsh -e 'describe mykeyspac' > mykeyspace.cql
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).
Mount this volume into docker cassandra in the
docker-compose.yaml
file- Started Docker
Connected to Docker using
docker exec -it container-id bash
and checked that the volume is correctly mounted.
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
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:
Exported keyspace definition using
cqlsh -e 'describe mykeyspac' > mykeyspace.cql
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).
Mount this volume into docker cassandra in the
docker-compose.yaml
file- Started Docker
Connected to Docker using
docker exec -it container-id bash
and checked that the volume is correctly mounted.
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
backup docker
edited Jan 25 at 20:15
zx485
1,2051913
1,2051913
asked Jan 25 at 13:46
George de LemosGeorge de Lemos
62
62
add a comment |
add a comment |
0
active
oldest
votes
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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