The task is follows: Write node.js server that will work with a ScyllaDB, that will be placed on Docker container. I doing this earlier, but on Ubuntu, and its work fine, now I should do it on Windows 10.
I installed Docker Toolbox for Windows and run commands from the scylladb docs.
$ docker run --name some-scylla -d scylladb/scylla
af51fa65627303db16a3de85003be8a165a64f37cf6ae29c0b4e887d64342ad2\
$ docker exec -it some-scylla cqlsh
Connected to at 172.17.0.2:9042.
[cqlsh 5.0.1 | Cassandra 3.0.8 | CQL spec 3.3.1 | Native protocol v4]
Use HELP for help.
cqlsh> CREATE KEYSPACE nodeTask WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3};
After this on my Node.js server I can set connection:
const cassandra = require("cassandra-driver")
const client = new cassandra.Client({
contactPoints: ["127.0.0.1"],
localDataCenter: "datacenter1",
keyspace: "nodetask"
})
As I say its works fine on Ubuntu with this IP - 127.0.0.1, BeaverDB(GUI) connect to this IP with 9042 port as default, but on Windows its doesn't work. There is no possibility to work on Ubuntu now.
Sorry for the bad question and maybe a little information, but I'm new to this and simply don’t know what exactly I need to tell
127.0.0.1is the loopback address, so your Node.js container keeps pinging itself instead of the host (your laptop). You can create your own bridge network and attach the two containers to that bridge networkNow run the ScyllaDB container as follows
In your Node.js script, change the
127.0.0.1tosome-scylla(name of your ScyllaDB container). The cool thing about user-defined bridge networks is that they let your containers talk to each other via their names. So the namesome-scyllawould resolve to whatever IP address thesome-scyllacontainer is using at the time.Now when you run your Node.js server, be sure to pass the
--net=scylla-netflag otherwise it wouldn't be able to resolve the namesome-scylla. Hope this helps!