first, the basic concept
ZooKeeper client wants to request the service of ZooKeeper server, first must connect with ZooKeeper server, establish "session". Second, conduct 2.1. End "Session" 2.1.1, explicitly ending "session" by client side of "Session "
For example, if you now have the following code:
Package com.dslztx.zookeeper;
Import org.apache.zookeeper.*;
Import java.io.IOException;
Import Java.util.Date;
public class Master {String hostport
previous address is the address of the primary database.
For the following username and password and listening port, of course, there are a few to write a few. If each database has the same username and password, you can write only one.
The code for parsing these options is as follows
$_config[' username '] = explode (', ', $this->config[' username '));$_config[' password '] = explode (', ', $this->config[' password '));$_config[' hostname '] = explode (', ', $this->config[' hostname '));$_c
; ' $this->nntpurl ',
' Telnet ' => ' $this->telneturl ',
' Wais ' => ' $this->waisurl '
);
var $lowalpha;
var $hialpha;
var $alpha;
var $digit;
var $safe;
var $extra;
var $national;
var $punctuation;
var $reserved;
var $hex;
var $escape;
var $unreserved;
var $uchar;
var $xchar;
var $digits;
var $urlpath;
var $password;
var $user;
var $port;
var $hostnumber;
var $alphadigit;
var $toplabel;
var $domainlabel;
var $hostname;
var $host;
var $hostport;
v
connect to the distributed database according to the above configuration.
Next, let's look at the following options:
'Db _ host'
For a distributed database, several server addresses are required for several servers. Each address is separated by a comma. For master-slave distribution, the preceding address is the address of the master database.
For the user name and password below, there are also listening ports and so on, of course, there are a few to write. If the user name and password of eac
database.For the following user name and password there are listening ports and so on, of course, there are a few to write a few. If the user name and password are the same for each database, you can write only one.The code for parsing these options is as follows$_config[' username '] = explode (', ', $this->config[' username ']);$_config[' password '] = explode (', ', $this->config[' password ']);$_config[' hostname '] = explode (', ', $this->config[' hostname ']);$_config['
$ user;
Var $ port;
Var $ hostnumber;
Var $ alphadigit;
Var $ toplabel;
Var $ domainlabel;
Var $ hostname;
Var $ host;
Var $ hostport;
Var $ login;
// Ftp
Var $ ftptype;
Var $ fsegment;
Var $ fpath;
Var $ ftpurl;
// File
Var $ fileurl;
// Http, https
Var $ search;
Var $ hsegment;
Var $ hpath;
Var $ httpurl;
// Gopher
Var $ gopher_string;
Var $ selector;
Var $ gtype;
Var $ gopherurl;
// News
Var $ article;
Var $ group;
Var $ grouppart;
Var $ news
' => ' $this->httpurl ',
' https ' => ' $this->httpurl ',
' Gopher ' => ' $this->gopherurl ',
' News ' => ' $this->newsurl ',
' NNTP ' => ' $this->nntpurl ',
' Telnet ' => ' $this->telneturl ',
' Wais ' => ' $this->waisurl '
);
var $lowalpha;
var $hialpha;
var $alpha;
var $digit;
var $safe;
var $extra;
var $national;
var $punctuation;
var $reserved;
var $hex;
var $escape;
var $unreserved;
var $uchar;
var $xchar;
var $digits;
var $urlpath;
var $password;
var $user;
var $port;
var $hostnumber;
previous address is the address of the primary database.
For the following user name and password there are listening ports and so on, of course, there are a few to write a few. If the user name and password are the same for each database, you can write only one.
The code for parsing these options is as follows
$_config[' username ' = explode (', ', $this->config[' username '); $_config[' password '] = Explode (', ', $this->config[' password '); $_config[' hostname '] = explode (', ',
effective ' db_master_num ' = 1,//read/write separation of the number of servers ' Db_slave_n O ' = = ',//Specify the number from the server
With the above configuration, you can connect to the distributed database.
Let's look at a few options below
' Db_host '
Distributed database, there are several servers to fill in several server addresses, each address separated by commas. If it is a master-slave distribution, the previous address is the address of the primary database.
For the following u
$ xchar;
Var $ digits;
Var $ urlpath;
Var $ password;
Var $ user;
Var $ port;
Var $ hostnumber;
Var $ alphadigit;
Var $ toplabel;
Var $ domainlabel;
Var $ hostname;
Var $ host;
Var $ hostport;
Var $ login;
// Ftp
Var $ ftptype;
Var $ fsegment;
Var $ fpath;
Var $ ftpurl;
// File
Var $ fileurl;
// Http, https
Var $ search;
Var $ hsegment;
Var $ hpath;
Var $ httpurl;
// Gopher
Var $ gopher_string;
Var $ selector;
Var $ gtype;
Var $ gopherurl;
// N
$ domainlabel;
Var $ hostname;
Var $ host;
Var $ hostport;
Var $ login;
// Ftp
Var $ ftptype;
Var $ fsegment;
Var $ fpath;
Var $ ftpurl;
// File
Var $ fileurl;
// Http, https
Var $ search;
Var $ hsegment;
Var $ hpath;
Var $ httpurl;
// Gopher
Var $ gopher_string;
Var $ selector;
Var $ gtype;
Var $ gopherurl;
// News
Var $ article;
Var $ group;
Var $ grouppart;
Var $ newsurl;
// Nntp
Var $ nntpurl;
// Telnet
Var $ telneturl;
// Wais
Var $ wpat
forwarding is divided into two types: local port forwarding and remote port forwarding. In fact, the two are similar, but the direction of ssh connection is different. For future convenience, we assume that there are three hosts A, B, C, and the hostnames are hosta, hostb, and hostc.
Local port forwarding
In local forwarding, a local port is forwarded to a port of another host, so that when our program connects to the local port, in fact, it is indirectly connected to a port of another host. w
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.