2

I want to move the data from my local SurrealDB instance to the one on my remote VM.

I created a new VM and used the Linux SurrealDB CLI tool to start a new instance SurrealDB:

curl -sSf https://install.surrealdb.com | sh

Then, after adding surreal to my $PATH, I ran the start command:

surreal start -u root -p root

After which, I created the same namespace and database that is in my local instance:

DEFINE NAMESPACE myNamespace;
USE NS myNamespace;
DEFINE DATABASE myDB;

I then ran the export command on my local machine:

surreal export -c http://127.0.0.1:8000 -u root -p root --ns myNamespace --db myDB export.sql  

Followed by the import command (containing the IP of the remote server)

surreal import -c http://123.456.789.012:8000 -u root -p root --ns myNamespace --db myDB export.sql

But I get a 400 error in my remote VM console:

[2023-03-06 16:53:02] INFO  surrealdb::iam Root authentication is enabled
[2023-03-06 16:53:02] INFO  surrealdb::iam Root username is 'root'
[2023-03-06 16:53:02] INFO  surrealdb::dbs Database strict mode is disabled
[2023-03-06 16:53:02] INFO  surrealdb::kvs Starting kvs store in memory
[2023-03-06 16:53:02] INFO  surrealdb::kvs Started kvs store in memory
[2023-03-06 16:53:02] INFO  surrealdb::net Starting web server on 0.0.0.0:8000
[2023-03-06 16:53:02] INFO  surrealdb::net Started web server on 0.0.0.0:8000
[2023-03-06 16:53:52] INFO  surreal::web 456.789.012.345:32589 POST /import HTTP/1.1 400 "-" 39.977596075s

And the following error in my local machine console:

> surreal import -c http://123.456.789.012:8000 -u root -p root --ns myNamespace --db myDB export.sql
[2023-03-06 16:53:42] ERROR surrealdb::cli There was an error with the remote request: error sending request for url (http://123.456.789.012:8000/import): operation timed out

Yet, when I run:

SELECT * FROM count((SELECT * FROM users))

In postman, I get a 200 response:

enter image description here

So everything seems okay?

What am I missing here?

EDIT:

I cannot simply copy & paste the contents of export.sql into my Postman environment because then I receive a 403:

{
    "code": 413,
    "details": "Payload too large",
    "description": "The request has exceeded the maximum payload size. Refer to the documentation for the request limitations."
}

EDIT 2:

I closed the running SurrealDB instance on my VM and started it up using:

surreal start --log debug --user root --pass root

And when I try to run my import command from my local machine, I get the following output in my VM:

[2023-03-07 10:09:42] DEBUG surrealdb::iam Authenticated as super user
[2023-03-07 10:09:53] INFO  surreal::web 456.789.012.345:32589 POST /import HTTP/1.1 400 "-" 38.953348008s
nopassport1
  • 1,821
  • 1
  • 25
  • 53

0 Answers0