远程登录VMWare内Ubuntu安装的Cassandra

需要修改/etc/cassandra/cassandra.yaml文件,里面需要修改的主要是rpc_address和seed_provider里面的seeds,这里的node-ip是指Cassandra节点的ip地址。

listen_address: [node-ip]
rpc_address: 0.0.0.0
seed_provider:
  - class_name: ...
    - seeds:"[node-ip]"

listen_address是指Cassandra Node的监听地址,主要与其他节点进行通信。
rpc_address应该是指客户端连接的地址。
最后的seeds选项有点坑,一时半会儿看不懂到底是做什么的,但是不将seeds设置为节点ip或节点ip:端口的形式,用cqlsh连接就会出现Connection error: ('Unable to connect to any servers', {'127.0.0.1:9042': ConnectionRefusedError(111, "Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused")})

查了/var/log/cassandra/system.log发现如下记录,这里的127.0.0.1:7000是cassandra.yaml中的默认配置,猜测为Netty注册的时候这个端口的访问有问题,所以会拒绝,但是明面上看不出来原因。

io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: /127.0.0.1:7000
Caused by: java.net.ConnectException: finishConnect(..) failed: Connection refused
        at io.netty.channel.unix.Errors.throwConnectException(Errors.java:124)
        at io.netty.channel.unix.Socket.finishConnect(Socket.java:251)
        at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.doFinishConnect(AbstractEpollChannel.java:673)
        at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.finishConnect(AbstractEpollChannel.java:650)
        at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.epollOutReady(AbstractEpollChannel.java:530)
        at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:470)
        at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378)
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:750)

参考链接1
参考链接2

20230508
MySQL允许远程连接
1、创建可以远程登录的用户

GRAN ALL PRIVILEGES ON *.* TO '$USRNAME'@'%' IDETIFIED BY '$PASSWORD'

2、设置监听地址

/etc/mysql/mysql.conf.d/mysqld.cnf

3、设置防火墙

sudo ufw allow 
sudo ufw deny

你可能感兴趣的:(远程登录VMWare内Ubuntu安装的Cassandra)