# How to import data into new cluster

**URL:** <https://discuss.dgraph.io/t/how-to-import-data-into-new-cluster/10549>\
**Category:** Dgraph\
**Tags:** kind:question\
**Created:** [September 22, 2020, 2:06am UTC](https://discuss.dgraph.io/t/how-to-import-data-into-new-cluster/10549 "2020-09-22T02:06:51Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Soultrans](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/soultrans/32/4919_2.png) [@Soultrans](https://discuss.dgraph.io/u/Soultrans)\
**Post date:** [September 22, 2020, 2:06am UTC](https://discuss.dgraph.io/t/how-to-import-data-into-new-cluster/10549/1 "2020-09-22T02:06:51Z")

</div>

By the way,How can I import data on a new cluster:

```auto
docker exec -it dgraph dgraph live -f 1million.rdf.gz --alpha localhost:9081 --zero localhost:5081 -c 1

```

That doesn’t seem to work

---

<div class="post-metadata">

**Author:** ![rajas](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/rajas/32/4393_2.png) [@rajas](https://discuss.dgraph.io/u/rajas)\
**Post date:** [September 22, 2020, 5:37am UTC](https://discuss.dgraph.io/t/how-to-import-data-into-new-cluster/10549/2 "2020-09-22T05:37:16Z")

</div>

Linking a related issue, [Live loader not working in docker](http://discuss.hypermode.com/t/live-loader-not-working-in-docker/5926) .  
The problem seems to be that docker runs its separate network in which containers are accessible using their service names and not localhost.  
Let us know if you face any other issues while running live loader with docker.

---

<div class="post-metadata">

**Author:** ![Soultrans](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/soultrans/32/4919_2.png) [@Soultrans](https://discuss.dgraph.io/u/Soultrans)\
**Post date:** [September 22, 2020, 7:28am UTC](https://discuss.dgraph.io/t/how-to-import-data-into-new-cluster/10549/3 "2020-09-22T07:28:49Z")

</div>

OK,many thanks!  
By the way, in “volumes: - /tmp/data:/dgraph” what does “/dgraph” mean？Isn’t it a containerFile?  
Why can’t I change it to “test”?

```auto
# This Docker Compose file can be used to quickly bootup Dgraph Zero
# and Alpha in different Docker containers.

# It mounts /tmp/data on the host machine to /dgraph within the
# container. You can change /tmp/data to a more appropriate location.
# Run `docker-compose up` to start Dgraph.

version: "3.2"
services:
  zero:
    image: dgraph/dgraph:latest
    volumes:
      - /tmp/data:/dgraph
    ports:
      - 5080:5080
      - 6080:6080
    restart: on-failure
    command: dgraph zero --my=zero:5080
  alpha:
    image: dgraph/dgraph:latest
    volumes:
      - /tmp/data:/dgraph
    ports:
      - 8080:8080
      - 9080:9080
    restart: on-failure
    command: dgraph alpha --my=alpha:7080 --lru_mb=2048 --zero=zero:5080
  ratel:
    image: dgraph/dgraph:latest
    ports:
      - 8000:8000
    command: dgraph-ratel

```

---

<div class="post-metadata">

**Author:** ![Soultrans](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/soultrans/32/4919_2.png) [@Soultrans](https://discuss.dgraph.io/u/Soultrans)\
**Post date:** [September 22, 2020, 8:11am UTC](https://discuss.dgraph.io/t/how-to-import-data-into-new-cluster/10549/4 "2020-09-22T08:11:24Z")

</div>

It doesn’t seem to work either.

```auto
dgraph live -f 1million.rdf.gz -s schema -a alphatest:9082

```

```auto
server@server-dgraph:~/dgraph$ dgraph live -f 1million.rdf.gz -s schema -a alphatest:9082
[Decoder]: Using assembly version of decoder
I0922 16:06:19.387219 24053 init.go:99] 

Dgraph version : v20.03.3
Dgraph SHA-256 : 08424035910be6b6720570427948bab8352a0b5a6d59a0d20c3ec5ed29533121
Commit SHA-1 : fa3c19120
Commit timestamp : 2020-06-02 16:47:25 -0700
Branch : HEAD
Go version : go1.14.1

For Dgraph official documentation, visit https://docs.dgraph.io.
For discussions about Dgraph , visit http://discuss.hypermode.com.
To say hi to the community , visit https://dgraph.slack.com.

Licensed variously under the Apache Public License 2.0 and Dgraph Community License.
Copyright 2015-2020 Dgraph Labs, Inc.

Running transaction with dgraph endpoint: alphatest:9082
While trying to setup connection: context deadline exceeded. Retrying...
2020/09/22 16:06:30 Could not setup connection after 1 retries
github.com/dgraph-io/dgraph/x.Fatalf
	/ext-go/1/src/github.com/dgraph-io/dgraph/x/error.go:114
github.com/dgraph-io/dgraph/x.GetDgraphClient
	/ext-go/1/src/github.com/dgraph-io/dgraph/x/x.go:793
github.com/dgraph-io/dgraph/dgraph/cmd/live.run
	/ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/live/run.go:440
github.com/dgraph-io/dgraph/dgraph/cmd/live.init.0.func1
	/ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/live/run.go:120
github.com/spf13/cobra.(*Command).execute
	/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:830
github.com/spf13/cobra.(*Command).ExecuteC
	/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914
github.com/spf13/cobra.(*Command).Execute
	/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
github.com/dgraph-io/dgraph/dgraph/cmd.Execute
	/ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/root.go:70
main.main
	/ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/main.go:78
runtime.main
	/usr/local/go/src/runtime/proc.go:203
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1373

```

---

<div class="post-metadata">

**Author:** ![rajas](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/rajas/32/4393_2.png) [@rajas](https://discuss.dgraph.io/u/rajas)\
**Post date:** [September 22, 2020, 10:42am UTC](https://discuss.dgraph.io/t/how-to-import-data-into-new-cluster/10549/5 "2020-09-22T10:42:07Z")

</div>

Hi @Soultrans,

The `/dgraph` is the folder inside docker container where `/tmp/data` from the host machine gets mounted. You may read more about docker volumes [here](https://docs.docker.com/storage/volumes/).

The error which you are facing looks similar to the linked issue. Is the alpha node being run as at `alphatest:9082` . As per the docker compose file provide, it looks like this should be `alpha:9080` instead.

---

<div class="post-metadata">

**Author:** ![Soultrans](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/soultrans/32/4919_2.png) [@Soultrans](https://discuss.dgraph.io/u/Soultrans)\
**Post date:** [September 22, 2020, 11:17am UTC](https://discuss.dgraph.io/t/how-to-import-data-into-new-cluster/10549/6 "2020-09-22T11:17:58Z")

</div>

Thanks,@Rajas  
I’m running multiple clusters on the same server.Now I would like to use the data provided by the official  
And the docker compose file as follows：

```auto
version: "3.2"
services:
  zerotest:
    image: dgraph/dgraph:latest
    volumes:
      - /home/server/dgraph_data/test:/dgraph
    ports:
      - 5082:5082
      - 6082:6082
    restart: on-failure
    command: dgraph zero --my=zerotest:5082 -o 2
  alphatest:
    image: dgraph/dgraph:latest
    volumes:
      - /home/server/dgraph_data/test:/dgraph
    ports:
      - 8082:8082
      - 9082:9082
    restart: on-failure
    command: dgraph alpha --my=alphatest:7082 -o 2 --lru_mb=2048 --zero=zerotest:5082
  rateltest:
    image: dgraph/dgraph:latest
    ports:
      - 8002:8002
    command: dgraph-ratel

```

So,I just want to import this data on port 9082 .

---

<div class="post-metadata">

**Author:** ![rajas](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/rajas/32/4393_2.png) [@rajas](https://discuss.dgraph.io/u/rajas)\
**Post date:** [September 22, 2020, 11:49am UTC](https://discuss.dgraph.io/t/how-to-import-data-into-new-cluster/10549/7 "2020-09-22T11:49:08Z")

</div>

Are you able to access ratel on `localhost:8002` . I see that it has not been provided with any additional flags to point it to a running alpha node.

Also, how are you running `dgraph live` command. From host ? or from the docker container ?

---

<div class="post-metadata">

**Author:** ![Soultrans](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/soultrans/32/4919_2.png) [@Soultrans](https://discuss.dgraph.io/u/Soultrans)\
**Post date:** [September 22, 2020, 11:53am UTC](https://discuss.dgraph.io/t/how-to-import-data-into-new-cluster/10549/8 "2020-09-22T11:53:33Z")

</div>

I can’t access ratel on localhost:8002. I’m running dgraph live on host.

---

<div class="post-metadata">

**Author:** ![rajas](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/rajas/32/4393_2.png) [@rajas](https://discuss.dgraph.io/u/rajas)\
**Post date:** [September 22, 2020, 11:57am UTC](https://discuss.dgraph.io/t/how-to-import-data-into-new-cluster/10549/9 "2020-09-22T11:57:56Z")

</div>

Can you try running `dgraph live` in one of the containers ? or by using `docker exec` from the host machine ?

ratel is not accessible because by default it tries to reach dgraph server on localhost:8080. You will have to provide it the location of alpha server using `--addr` flag along with the command for dgraph ratel.

---

<div class="post-metadata">

**Author:** ![Soultrans](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/soultrans/32/4919_2.png) [@Soultrans](https://discuss.dgraph.io/u/Soultrans)\
**Post date:** [September 22, 2020, 12:02pm UTC](https://discuss.dgraph.io/t/how-to-import-data-into-new-cluster/10549/10 "2020-09-22T12:02:59Z")

</div>

I want to achieve this by running in host, as I am not very familiar with Docker.  
And how can I access it at 8002?  
Just like this？

```auto
command: dgraph alpha --my=alphatest:7082 -o 2 --lru_mb=2048 --zero=zerotest:5082

```

I can access port 8082、9082，port 8002 cannot be accessed.Why is this happening 🤔  
Running inside the container：  
“zero” should be “zerotest” ,it should run at 127.0.0.1:5082

```auto
root@93e0aa005bfa:/dgraph# dgraph live -f 1million.rdf.gz -s schema -a alphatest:9082
[Decoder]: Using assembly version of decoder
I0922 12:23:39.404698 53 init.go:99] 

Dgraph version : v20.03.3
Dgraph SHA-256 : 08424035910be6b6720570427948bab8352a0b5a6d59a0d20c3ec5ed29533121
Commit SHA-1 : fa3c19120
Commit timestamp : 2020-06-02 16:47:25 -0700
Branch : HEAD
Go version : go1.14.1

For Dgraph official documentation, visit https://docs.dgraph.io.
For discussions about Dgraph , visit http://discuss.hypermode.com.
To say hi to the community , visit https://dgraph.slack.com.

Licensed variously under the Apache Public License 2.0 and Dgraph Community License.
Copyright 2015-2020 Dgraph Labs, Inc.
Running transaction with dgraph endpoint: alphatest:9082
2020/09/22 12:23:49 context deadline exceeded
Unable to connect to zero, Is it running at 127.0.0.1:5080?
github.com/dgraph-io/dgraph/x.Checkf
	/ext-go/1/src/github.com/dgraph-io/dgraph/x/error.go:51
github.com/dgraph-io/dgraph/dgraph/cmd/live.setup
	/ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/live/run.go:383
github.com/dgraph-io/dgraph/dgraph/cmd/live.run
	/ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/live/run.go:443
github.com/dgraph-io/dgraph/dgraph/cmd/live.init.0.func1
	/ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/live/run.go:120
github.com/spf13/cobra.(*Command).execute
	/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:830
github.com/spf13/cobra.(*Command).ExecuteC
	/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914
github.com/spf13/cobra.(*Command).Execute
	/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
github.com/dgraph-io/dgraph/dgraph/cmd.Execute
	/ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/root.go:70
main.main
	/ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/main.go:78
runtime.main
	/usr/local/go/src/runtime/proc.go:203
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1373

```

---

<div class="post-metadata">

**Author:** ![rajas](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/rajas/32/4393_2.png) [@rajas](https://discuss.dgraph.io/u/rajas)\
**Post date:** [September 22, 2020, 12:43pm UTC](https://discuss.dgraph.io/t/how-to-import-data-into-new-cluster/10549/11 "2020-09-22T12:43:00Z")

</div>

> [@Soultrans](#):
>
> ```auto
> Unable to connect to zero, Is it running at 127.0.0.1:5080?
> 
> ```

By default the live loader is trying to connect to zero at 127.0.0.1:5080 . Can you pass the correct address of zero (zerotest:5082) using --zero flag to the live loader.

For more information on dgraph live loader flags, you may run `dgraph live --help` .

---

<div class="post-metadata">

**Author:** ![Soultrans](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/soultrans/32/4919_2.png) [@Soultrans](https://discuss.dgraph.io/u/Soultrans)\
**Post date:** [September 22, 2020, 12:54pm UTC](https://discuss.dgraph.io/t/how-to-import-data-into-new-cluster/10549/12 "2020-09-22T12:54:31Z")

</div>

```auto
dgraph live -f 1million.rdf.gz -s schema -a alphatest:9082 -z zerotest:5082

```

```auto
root@93e0aa005bfa:/dgraph# dgraph live -f 1million.rdf.gz -s schema -a alphatest:9082 -z zerotest:5082
[Decoder]: Using assembly version of decoder
I0922 12:57:17.709947 142 init.go:99] 

Dgraph version : v20.03.3
Dgraph SHA-256 : 08424035910be6b6720570427948bab8352a0b5a6d59a0d20c3ec5ed29533121
Commit SHA-1 : fa3c19120
Commit timestamp : 2020-06-02 16:47:25 -0700
Branch : HEAD
Go version : go1.14.1

For Dgraph official documentation, visit https://docs.dgraph.io.
For discussions about Dgraph , visit http://discuss.hypermode.com.
To say hi to the community , visit https://dgraph.slack.com.

Licensed variously under the Apache Public License 2.0 and Dgraph Community License.
Copyright 2015-2020 Dgraph Labs, Inc.

Running transaction with dgraph endpoint: alphatest:9082

Processing schema file "schema"
2020/09/22 12:57:17 open schema: no such file or directory

```

That doesn’t seem to work

---

<div class="post-metadata">

**Author:** ![rajas](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/rajas/32/4393_2.png) [@rajas](https://discuss.dgraph.io/u/rajas)\
**Post date:** [September 22, 2020, 1:00pm UTC](https://discuss.dgraph.io/t/how-to-import-data-into-new-cluster/10549/13 "2020-09-22T13:00:20Z")

</div>

@Soultrans, The error is different this time. The error now is that the live loader was not able to find schema file . Can you check if there exists a schema file at `/dgraph/schema` inside the container from where this command is being run ?  
Can you point the right location of schema file to `-s` flag.

---

<div class="post-metadata">

**Author:** ![Soultrans](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/soultrans/32/4919_2.png) [@Soultrans](https://discuss.dgraph.io/u/Soultrans)\
**Post date:** [September 22, 2020, 1:03pm UTC](https://discuss.dgraph.io/t/how-to-import-data-into-new-cluster/10549/14 "2020-09-22T13:03:21Z")

</div>

there isn’t exists a schema file at `/dgraph/schema` inside the container.  
I downloaded the data set ”1million.rdf.gz“ from the official website，I just want to import it.  
[Like this example](https://dgraph.io/tour/moredata/1/)

---

<div class="post-metadata">

**Author:** ![rajas](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/rajas/32/4393_2.png) [@rajas](https://discuss.dgraph.io/u/rajas)\
**Post date:** [September 22, 2020, 2:25pm UTC](https://discuss.dgraph.io/t/how-to-import-data-into-new-cluster/10549/15 "2020-09-22T14:25:59Z")

</div>

In that case, don’t provide `-s` flag.

You may read more details about live loader over [here](https://dgraph.io/docs/deploy/fast-data-loading/#live-loader) .

---

<div class="post-metadata">

**Author:** ![Soultrans](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/soultrans/32/4919_2.png) [@Soultrans](https://discuss.dgraph.io/u/Soultrans)\
**Post date:** [September 23, 2020, 2:15am UTC](https://discuss.dgraph.io/t/how-to-import-data-into-new-cluster/10549/16 "2020-09-23T02:15:23Z")

</div>

Thanks @rajas  
I still want to know how to connect to port 8002.Can you give me some concrete examples?

By the way,is this success?Why can’t I see any data at Ratel.Or is it an enterprise feature? 😥

```auto
root@93e0aa005bfa:/dgraph# dgraph live -f 1million.rdf.gz -a alphatest:9082 -z zerotest:5082
[Decoder]: Using assembly version of decoder
I0923 02:35:09.423704 202 init.go:99] 

Dgraph version : v20.03.3
Dgraph SHA-256 : 08424035910be6b6720570427948bab8352a0b5a6d59a0d20c3ec5ed29533121
Commit SHA-1 : fa3c19120
Commit timestamp : 2020-06-02 16:47:25 -0700
Branch : HEAD
Go version : go1.14.1

For Dgraph official documentation, visit https://docs.dgraph.io.
For discussions about Dgraph , visit http://discuss.hypermode.com.
To say hi to the community , visit https://dgraph.slack.com.

Licensed variously under the Apache Public License 2.0 and Dgraph Community License.
Copyright 2015-2020 Dgraph Labs, Inc.

Running transaction with dgraph endpoint: alphatest:9082
Found 1 data file(s) to process
Processing data file "1million.rdf.gz"
2020/09/23 02:35:09 EOF

github.com/dgraph-io/dgraph/x.Check
	/ext-go/1/src/github.com/dgraph-io/dgraph/x/error.go:42
github.com/dgraph-io/dgraph/chunker.FileReader
	/ext-go/1/src/github.com/dgraph-io/dgraph/chunker/chunk.go:372
github.com/dgraph-io/dgraph/dgraph/cmd/live.(*loader).processFile
	/ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/live/run.go:257
github.com/dgraph-io/dgraph/dgraph/cmd/live.run.func2
	/ext-go/1/src/github.com/dgraph-io/dgraph/dgraph/cmd/live/run.go:482
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1373

```

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [September 23, 2020, 4:01am UTC](https://discuss.dgraph.io/t/how-to-import-data-into-new-cluster/10549/17 "2020-09-23T04:01:01Z")

</div>

> [@Soultrans](#):
>
> I still want to know how to connect to port 8002.Can you give me some concrete examples?

Hey, your YAML sets Ratel to `- 8002:8002` which

1. Should not be changed at all, as Ratel have nothing to do with Dgraph’s port offset.
2. You should use the kind of forwarding in the docker compose. `(HOST:CONTAINER)` so, the port on your YAML should be `- 8002:8000`. Therefore, as Ratel is being served in the port 8000, not 8002, you got nothing in the port combination you have used.

> [@Soultrans](#):
>
> By the way,is this success?

Nope.

> [@Soultrans](#):
>
> Why can’t I see any data at Ratel.Or is it an enterprise feature?

There is no enterprise feature on your context. We have only

- [Binary Backups](https://dgraph.io/docs/enterprise-features/binary-backups/)
- [Access Control Lists](https://dgraph.io/docs/enterprise-features/access-control-lists/)
- [Encryption at Rest](https://dgraph.io/docs/enterprise-features/encryption-at-rest/)

Nothing more. This error you got means something else.

Delete the file and download it again. Feels like it is currupted.

---

<div class="post-metadata">

**Author:** ![Soultrans](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/soultrans/32/4919_2.png) [@Soultrans](https://discuss.dgraph.io/u/Soultrans)\
**Post date:** [September 23, 2020, 5:39am UTC](https://discuss.dgraph.io/t/how-to-import-data-into-new-cluster/10549/18 "2020-09-23T05:39:22Z")

</div>

I did this operation

> wget “[https://github.com/dgraph-io/tutorial/blob/master/resources/1million.rdf.gz?raw=true](https://github.com/dgraph-io/tutorial/blob/master/resources/1million.rdf.gz?raw=true)” -O 1million.rdf.gz -q

I still don’t see what you mean @MichelDiz .Isn’t the data from the official source？

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [September 23, 2020, 6:54am UTC](https://discuss.dgraph.io/t/how-to-import-data-into-new-cluster/10549/19 "2020-09-23T06:54:57Z")

</div>

> [@Soultrans](#):
>
> I still don’t see what you mean

which part?

> [@Soultrans](#):
>
> Isn’t the data from the official source？

yes, it is. Sometimes we can have bad packages from the internet and create a corrupted file. But that is probably not the case. Just a guess.

If you have a way to reproduce this would be nice. Is quite hard to tell by “EOF”, which in Unix like systems means “Bad End of File”.

---

<div class="post-metadata">

**Author:** ![Soultrans](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/soultrans/32/4919_2.png) [@Soultrans](https://discuss.dgraph.io/u/Soultrans)\
**Post date:** [September 23, 2020, 7:04am UTC](https://discuss.dgraph.io/t/how-to-import-data-into-new-cluster/10549/20 "2020-09-23T07:04:17Z")

</div>

Well, I’ll keep trying. Thank you @MichelDiz
