tôi cố gắng viết một số dữ liệu để HBase với một phần mềm clientTruy cập HBase chạy trong máy ảo với một khách hàng trên hệ thống máy chủ
HBase @ Hadoop chạy trong một cấu hình VM từ Cloudera @ ubuntu.
Máy khách chạy trên hệ thống lưu trữ máy ảo và chạy ứng dụng khách trực tiếp trong máy ảo.
Vì vậy, bây giờ tôi muốn sử dụng ứng dụng khách bên ngoài vm để truy cập máy chủ trên vm
Tôi đang sử dụng NAT. Để có thể truy cập vào các máy chủ như HBase Master, HUE..running trên vm tôi cấu hình cổng chuyển tiếp trong hộp ảo:
Như vậy tôi có thể đạt được các trang web tổng quan về các HBase Master, HUẾ ..
Để chạy client chống lại các máy chủ trên vm tôi tạo ra HBase-site.xml với nội dung:
<configuration>
<property>
<name>hbase.zookeeper.quorum</name>
<value>localhost</value>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>9997</value>
</property>
<property>
<name>hbase.master</name>
<value>localhost:9999</value>
</property>
</configuration>
Vì vậy, tôi hy vọng chuyển tiếp hoạt động:
thông báo lỗi s trong nhật ký khi chạy client trông giống như:
11/09/07 17:48:00 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=localhost:2181 sessionTimeout=180000 watcher=hconnection
11/09/07 17:48:00 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181
11/09/07 17:48:01 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused: no further information
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1119)
11/09/07 17:48:01 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181
11/09/07 17:48:01 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.SocketException: Address family not supported by protocol family: connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:500)
at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:1050)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1077)
11/09/07 17:48:03 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181
11/09/07 17:48:04 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused: no further information
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1119)
11/09/07 17:48:04 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181
11/09/07 17:48:04 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.SocketException: Address family not supported by protocol family: connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:500)
at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:1050)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1077)
11/09/07 17:48:05 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181
Một bản ghi kết nối chính xác (khi chạy client trực tiếp trên vm) trông giống như:
11/09/07 09:05:29 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=localhost:2181 sessionTimeout=180000 watcher=hconnection
11/09/07 09:05:29 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181
11/09/07 09:05:29 INFO zookeeper.ClientCnxn: Socket connection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session
11/09/07 09:05:29 INFO zookeeper.ClientCnxn: Session establishment complete on server localhost/0:0:0:0:0:0:0:1:2181, sessionid = 0x132449d36df0006, negotiated timeout = 40000
Vì vậy, tôi chỉ thấy bây giờ trong nhật ký dòng trước vấn đề đầu tiên mà url kết nối là không đúng như cảng được chuyển tiếp một cách chính xác nhưng IP vẫn localhost và không 10.0.2.15 như cấu hình trong các thiết lập cổng chuyển tiếp:
Opening socket connection to server localhost/127.0.0.1:2181
Chỉ gợi ý tôi tìm thấy là vô hiệu hoá IPV6 -> bị tắt trong máy chủ (win7) và vm (Ubuntu) và kiểm tra cổng -> chúng được chuyển tiếp chính xác
Có ai có ý tưởng không?
cổng của bạn có vẻ không đúng với tôi. Bạn đang đăng nhập nói localhost: 2181 bạn đã cấu hình 9997. Tôi đã thử thiết lập tương tự trên cụm Hộp Ảo của tôi và nó hoạt động tốt. Trên thực tế bạn không cần phải thiết lập các cổng khác, ở lại với cùng trên máy ảo của bạn. => Không có sự nhầm lẫn :) Nếu đây không phải là vấn đề bạn có thể chuyển tiếp cổng 22 và mở một kết nối SSH thông qua putty và tunnel các cổng của bạn. –