You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Valentina Ivanova <va...@ri.se> on 2020/03/09 09:25:14 UTC

Data not persisted in Cassandra docker

Hello!

I am using Cassandra 3.11.5 from docker. I created a keyspace and a table in it and inserted some data into the table. Before stopping the container I executed nodetool flush to persist the data. However, upon starting the container after the weekend, the keyspace, table and data were not existent. What shall I do in order to persist the data?

Many thanks & have a great week!

Valentina

Re: Data not persisted in Cassandra docker

Posted by Cedrick Lunven <ce...@datastax.com>.
Hi, here is a sample docker-compose.yaml for what you need.

version: '2'
services:
  cassandra:
    image: cassandra:3.11.5
    ports:
      - 7000:7000
      - 7001:7001
      - 7199:7199
      - 9042:9042
      - 9160:9160
    ulimits:
      memlock: -1
    volumes:
       - ~/cassandra/:/var/lib/cassandra/data



On Mon, Mar 9, 2020 at 10:30 AM Hannu Kröger <hk...@gmail.com> wrote:

> You need to mount volumes from the host system or docker volumes to
> container to have data persisted.
>
> See section "Where to Store Data” in https://hub.docker.com/_/cassandra
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__hub.docker.com_-5F_cassandra&d=DwMFaQ&c=adz96Xi0w1RHqtPMowiL2g&r=CRDTby7ZKMKOJuR7qj8hGNHMqiMtY_3sbc8FBSZtTdo&m=fC7lJdBwv7dkE9mFT5eMXieeQlbrP21x6_UnVGYkMN0&s=zzXuvpiY65xI5PzEAMEba8h33nou2NAblTI5O0xzbn4&e=>
>
> Hannu
>
> On 9. Mar 2020, at 11.25, Valentina Ivanova <va...@ri.se>
> wrote:
>
> Hello!
>
> I am using Cassandra 3.11.5 from docker. I created a keyspace and a table
> in it and inserted some data into the table. Before stopping the container
> I executed nodetool flush to persist the data. However, upon starting the
> container after the weekend, the keyspace, table and data were not
> existent. What shall I do in order to persist the data?
>
> Many thanks & have a great week!
>
> Valentina
>
>
>

-- 


*Cédrick Lunven | *EMEA Developer Advocate


*🎓**Free Trainings : *DataStax Academy <https://academy.datastax.com/>* ❓**Ask
us your questions** :* DataStax Community
<https://community.datastax.com/index.html>* 🔬**Test our new
products** : *DataStax
Labs <https://downloads.datastax.com/#labs>

<https://luna.datastax.com/>

Re: Data not persisted in Cassandra docker

Posted by Hannu Kröger <hk...@gmail.com>.
You need to mount volumes from the host system or docker volumes to container to have data persisted.

See section "Where to Store Data” in https://hub.docker.com/_/cassandra <https://hub.docker.com/_/cassandra>

Hannu

> On 9. Mar 2020, at 11.25, Valentina Ivanova <va...@ri.se> wrote:
> 
> Hello!
> 
> I am using Cassandra 3.11.5 from docker. I created a keyspace and a table in it and inserted some data into the table. Before stopping the container I executed nodetool flush to persist the data. However, upon starting the container after the weekend, the keyspace, table and data were not existent. What shall I do in order to persist the data?
> 
> Many thanks & have a great week!
> 
> Valentina