I want to run two instances of cassandra on a single machine. It runs fine with two loopback addresses 127.0.0.1 and 127.0.0.1 as the listen_address, rpc_address with the same native_port: 9042. But i shall be using the two resultant single-node clusters from a different machine so i need to have the addresses which can be identified by the other machines(loopbacks and localhost out of question) of the network.
Is there a way to achieve this?
You first need to create 2 IP address for your machine. This can be done by
Setting 2 NIC Cards (or)
Assigning multiple IP for a single NIC.
This can be done by assigning static IP (Make sure you provide the proper gateway and subnet so it will be accessible by other machine) and assign IP addresses, below link explains how to assign multiple IP addresses along with the bottlenecks of doing so:
http://www.tomshardware.com/faq/id-1925787/computer-address.html
After you have created 2 IP addresses, start each Cassandra Server with different IP address.
Do a telnet test:
telnet <IP address> <port(9042)>
from any other machine to check your Cassandra server is started with the assigned IP address.
Related
I'm attempting to set up a STUN server using STUN server for Node.js:
https://github.com/enobufs/stun
The readme has the following guidance:
Place a config file named as node-stun.ini in
your current directory. The config file should look like following.
(These local loopback addresses should be routable public IP addresses
in the real settings, of course)
[primary] host = 127.0.0.1
[secondary] host = 127.0.0.2
Does anyone know what the primary and secondary IPs should be? Should the primary be the IP address of my STUN server machine? What should the secondary be?
Could I set them as localhost and route requests to the server with nginx?
Finally, why does the software need to refer to these IP addresses?
Technically, STUN requires two unique public IP addresses on the server. But most client implementations only need one and don't use the alternate/secondary address. And the server code needs to know what these addresses are for two reasons:
So that the server knows which address to bind the sockets to. (It would need the local ip addresses for each)
So that the server can advertise the alternate IP address when a binding request hits the primary IP. (It needs to know the public IP addresses of the host if its behind a NAT with port forwarding).
If you don't have a secondary IP address to offer, then give in any address that allows the server to run. This will break STUN behavior and filtering tests, but rarely do clients need this.
I have a question about Cassandra.
Is it possible to open Cassandra client connection on many IPs?
On my server I have 2 network cards (eth0 and eth1) with IP 10.197.11.21 (eth0) and 192.168.0.45 (eth1) and 127.0.0.1 (lo).
I want my client to connect to Cassandra database with this three IP
in localhost, 10.197.11.21 and 192.168.0.45
For the moment I can choose only 1 IP, what does it do to modify in the file cassandra.yaml ?
You need to set rpc_address: 0.0.0.0 in cassandra.yaml
Note that when you set rpc_address to 0.0.0.0, you also must set broadcast_rpc_address to something other than 0.0.0.0 (e.g. 10.197.11.21).
rpc_address is the address that Cassandra listens on for connections from clients
listen_address is the address that Cassandra listens on for connections from other Cassandra nodes (not client connections)
broadcast_rpc_address is the address that Cassandra broadcasts to clients that are attempting to discover the other nodes in the cluster. When an application first connects to a Cassandra cluster, the cluster sends the application a list of all the nodes in the cluster, and their IP addresses. The IP address sent to the application is the broadcast_ip_address (side-note: cassandra actually sends all IP addresses, this is just the one that it tells the client to connect on). This allows the application to auto-discover all the nodes in the cluster, even if only one IP address was given to the application. This also allows applications to handle situations like a node going offline, or new nodes being added.
Even though your broadcast_rpc_address can only point to one of those two IP addresses, you application can still connect to either one. However, your application will also attempt to connect to other nodes via the broadcast_rpc_addresses sent back by the cluster. You can get around this by providing a full list of the address of every node in the cluster to your application, but the best solution is to build a driver-side address translator.
Is it possible to ping mininet ip? I found mininet's ip starts with 10.0.2.15 . I can ping from mininet to others. However, I failed to ping other place to mininet. How can I setup this?
10.0.0.0/8, which is 10.0.0.0 - 10.255.255.255 are IP addresses used only locally, they are not accessed from the internet (other networks). Here is some info from IANA:
These addresses are in use by many millions of independently operated networks, which might be as small as a single computer connected to a home gateway, and are automatically configured in hundreds of millions of devices. They are only intended for use within a private context and traffic that needs to cross the Internet will need to use a different, unique address.
These addresses can be used by anyone without any need to coordinate with IANA or an Internet registry. The traffic from these addresses does not come from ICANN or IANA. We are not the source of activity you may see on logs or in e-mail records.
I'm writing a distributed system and I want to test it on my machine. I created several ip addresses on the interface lo using ip addr add ip_add dev lo.
I have binded all servers to their specific addresses and now I want my servers to connect to each other such that each server would think that it connects from his own ip. But when I use connect I get connection from my localhost. How is it possible to connect from a specific ip address?
It turned out that calling bind() on my socket does all necessary work.
I created 3 instances with 3 Elastic IP addresses pointing to these instances.
I did a yum install of dsc:
dsc12.noarch 1.2.13-1 #datastax
And the /etc/cassandra/default.conf/cassandra.yaml has the:
- seeds: [Elastic IP list]
But when I start cassandra via "service cassandra start" I see in /var/log/cassandra/cassandra.log:
...
Exception encountered during startup: Unable to contact any seeds!
...
And sure enough "nodetool status" shows:
Failed to connect to '127.0.0.1:7199': Connection refused
BUT:
If I change the value of the seeds to use the "private IP" of the instance, cassandra starts just fine. I would expect it work just fine with the Elastic IP's, but it doesn't.
Do you know why that is?
The reason I want the Elastic IP's to work is that I know the IP address ahead of time, so that when I provision a machine with Puppet, I can pre-populate the seeds in cassandra.yaml file. I don't know the private IP address until after the machine has booted :(
This is almost a duplicate of: Cassandra on Amazon EC2 with Elastic IP addresses
I believe your problem comes from the seed IP's not being the same as the node's Broadcast IP's . To change this modify the following line in each of your Cassandra.yamls
# Address to broadcast to other Cassandra nodes
# Leaving this blank will set it to the same value as listen_address
broadcast_address: <node's elastic ip> #uncomment this line