Neo4j (v1.8 and v1.9) HA high availability, backup and restore security settings --- neo4j ttlsa Tutorial Series (three)

ttlsa Tutorial Series neo4j --- (three) Neo4j (v1.8 and v1.9) HA high availability, backup and restore security settings Environment Description: $ NEO4J_HOME1 neo4j 10.1.1.76 represents the server's installation directory $ NEO4J_HOME2 10.1 represents the server. 1.77 neo4j installation directory $ NEO4J_HOME3 server 10.1.1.78 representatives of environmental infrastructure neo4j installation directory 1. dependence: see "ttlsa tutorial series Neo4j --- (a) stand-alone installation steps"   http://www.ttlsa.com/html /1508.html Neo4j v1.9 version to install jdk 7. 2. Neo4j HA introduced Neo4j Enterprise Edition only offers high-availability features. Neo4j HA provides the following two functions:. A fault-tolerant database schema multiple copies of data stored, even if the hardware failure, but also to ensure writable. B. horizontal extension read operation to read the load balancing based architecture. Neo4j HA will be transferred to a single operation on multiple servers, it is transparent to the application, without changing the existing application code. Neo4j HA total single pattern master, zero or more slave. Copy architecture and other ms, Neo4j HA can handle the slave write operation without written redirected to master. Neo4j HA using Apache ZooKeeper to state elections and the dissemination of information between the master server. ZooKeeper can be seen as a distributed service coordinator. Neo4j HA cluster relies on ZooKeeper initial primary selection process, within the new master election and cluster server status reports. When the master fails, a new master will automatically elections. When the master fails, any write transactions are rolled back, and during the master election, any write operation will not occur. ZooKeeper ZooKeeper requires a lot of examples in order to ensure the normal operation. This means that the zookeeper instances should always be an odd number, so you can take full advantage of the hardware. Note:. A inter-cluster server system time to be synchronized, otherwise ZooKeeper work abnormally. b. cluster coordinator information permanently stored in the cluster, the service must be turned off to reconfigure coordinator example, delete data / coordinator / version-2 / * data file, restart the coordinator. 3. Neo4j HA configuration parameters ha.server_id: an integer greater than or equal to 0 and only necessary parameters ha.server: automatic discovery, when a master, host and port binding ha.coordinators: zookeeper coordinator, separated by commas, must parameters ha.cluster_name: cluster description ha.pull_interval: unit is s, the polling interval ha. slave_coordinator_update_mode: never be a slave master's (values ​​are sync, async, none) ha.read_timeout: slave master to wait for the response timeout, default 20s ha.lock_read_timeout: ha.max_concurrent_channels_per_slave: The maximum number of concurrent channels ha.branched_data_policy: ha.zk_session_timeout : ha.tx_push_factor: ha.tx_push_strategy: 4. configure cluster coordinator (coordinator cluster) to modify each server NEO4J directory the following files: # vim conf / coord.cfg // set coordinator to search for other members of the cluster IP and port ranges server.1 = 10.1.1.76: 2888: 3888 server.2 = 10.1.1.77: 2888: 3888 server.3 = 10.1.1.78: 2888: 3888 dataDir = / data / neo4j / coordinator // synchronization log storage directory clientPort = 2181 // monitor myid port created for each server in the cluster. id configuration file server.1, server.2, the same server3 $ neo4j_home1 # echo '1'> / data / neo4j / coordinator / myid $ neo4j_home2 # echo '2'> / data / neo4j / coordinator / myid $ neo4j_home3 # echo '3'> / Data / neo4j / coordinator / myid start coordinator cluster # $ NEO4J_HOME1 / bin / neo4j-coordinator start # $ NEO4J_HOME2 / bin / neo4j-coordinator start # $ NEO4J_HOME3 / bin / neo4j-coordinator start if there are unusual circumstances, the log information can be view the log file obtained from the data / log directory under each neo4j installation directory. Neo4j v1.8 High Availability 5. Neo4j HA cluster configuration mode and stand-alone configuration red font is not the same place. See "Neo4j series --- (a) stand-alone installation steps" # vim conf / neo4j.properties // on each cluster server $ NEO4J_HOME1 # vim conf / neo4j.properties neostore.nodestore.db.mapped_memory = 10G neostore.relationshipstore .db.mapped_memory = 60G neostore.propertystore.db.mapped_memory = 20G neostore.propertystore.db.strings.mapped_memory = 20G neostore.propertystore.db.arrays.mapped_memory = 0M node_auto_indexing = true node_keys_indexable = uid, mobile ha.server_id = 1 ha.coordinators = 10.1.1.76: 2181, 10.1.1.77:2181, 10.1.1.78:2181 ha.server = 10.1.1.76:6001 $ NEO4J_HOME2 # vim conf / neo4j.properties neostore.nodestore.db. Automatic discovery, when a master, host and port binding as my-domain.com:6001 ha.discovery.enabled: whether ha.discovery.url defined cluster ha.discovery.url: if true ha.discovery.enabled , used to define clusters, such as file: //my.server: 8080 / my-cluster ha.initial_hosts: If ha.discovery.enabled false, the other members of a comma-separated list added to the cluster. If there is no available members, it will create a new cluster. ha.cluster_server: automatic discovery. Host and port binding, cluster management communication. ha.pull_interval: active time interval during which slave pulls data from the updated master. The default is regularly updated when a write transaction. ha.read_timeout: wait for the master timeout time, default 20s ha.lock_read_timeout: ha.state_switch_timeout: How long is the largest, master / slave role switch has been tastefully ha.max_concurrent_channels_per_slave: The maximum number of concurrent channels and ha.branched_data_policy: ha.tx_push_factor: ha .tx_push_strategy: Neo4j HA cluster configuration mode and stand-alone configuration red font is not the same place. See "Neo4j series --- (a) stand-alone installation steps" $ NEO4J_HOME1 # vim conf / neo4j.properties neostore.nodestore.db.mapped_memory = 10G neostore.relationshipstore.db.mapped_memory = 60G neostore.propertystore.db.mapped_memory = 20G neostore.propertystore.db.strings. / Configuration> Neo4j Backup and Restore Backup description: Neo4j Enterprise Edition only provide backup service. Only the configuration parameters online_backup_enabled = true database can be backed up, the default port is 6362. (Neo4j 1.8 version is enabled by default, neo4j 1.9 version needs to be specified) supports two backup types: full backup and incremental backup. A full backup copy of the database file without locking any case, any line without affecting the operation. In order to ensure consistency of backup data, when the backup is complete, the entire backup process a transaction is re-executed again on the backup file. Incremental backups do not store a copy of the file, but a copy of the transaction log after full or incremental backup, and then perform a backup in the above already exist. More efficient than a full backup, it requires a full backup must exist before an incremental backup process. Once you create a backup, backup files have expressed a persistent database snapshots can be used to start a Neo4j database instance. Backup syntax is as follows: <running mode>: // <host> [: port] {, <host> [: port] *} running mode must be specified, and only a SINGLE (standalone mode) or HA (trunked mode). # ./Neo4j-backup -full -from single: perform a full backup Performing full backup from the //10.1.242.124 -to / data / backup / neo4j-backup // standalone mode 'single: //10.1.242.124'. ............................ [29 Files copied] Full consistency check .............. ...... 10% .................... .................... 20% .................... .................... 30% 40% 50% .... ..... ........... .................... 60% 70% ............... ..... 80% 90% .................... .................... 100 % Done # ./neo4j-backup -incremental -from single: the incremental execution //10.1.242.124 -to / data / backup / neo4j-backup // standalone mode backup performing incremental backup from 'single: //10.1. 242.124 '[0 Transactions applied] under Done HA backup mode: Neo4j v1.8 version, specify one or more management coordinator clusters. If you specify a name for the cluster HA cluster, you need to specify the name when a backup (add a configuration parameter: -cluster my_custom_cluster_name), so that the backup system to know which clusters need to back up. Note: Specify ha.coordinators address. # ./Neo4j-backup -full -from ha: //10.1.1.76: 2181,10.1.1.77: under 2181 -to / backup / neo4j-backup // HA mode, perform a full backup # ./neo4j-backup - incremental -from ha: //10.1.1.76: under 2181 -to / backup / neo4j-backup // HA mode, perform an incremental backup Neo4j v1.9 version, the need to target one or more members of the HA cluster . Note: You must specify ha.cluster_server address instead ha.server address. # ./Neo4j-backup -full -from ha: //10.1.1.76: 5001,10.1.1.77: Under 5001 -to / backup / neo4j-backup // HA mode, perform a full backup # ./neo4j-backup -incremental -from ha: //10.1.1.76: 5001 -to / backup / neo4j-backup // HA mode next, perform incremental backup and recovery: backup of the complete contents of the database Neo4j a certain moment. Recovery, only need to specify the directory database to the data directory can be backed up. Neo4j security Neo4j do not restrict the security at the data level. In a production environment should consider the security issues. 1. to make the white list server port restrictions. Within Port Desc 7473/7474 Webadmin administration port 6001 cluster member communications port 1337 6362 Single-port remote shell port 2181 HA backup service backup service port (v1.8) 5001 HA backup service port (v1.9) 2. Use third-party security certification plug # wget http://mirrors.cnnic.cn/apache/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz # wget --no-check-certificate https : //github.com/neo4j-contrib/authentication-extension/archive/1.8.zip -O neo4j-1.8-authentication-extension.zip # unzip neo4j-1.8-authentication-extension.zip # cd authentication-extension-1.8 / # /usr/local/apache-maven-3.0.5/bin/mvn clean package // packaged # cp authentication-extension-1.8.1-1.0-SNAPSHOT. Please indicate the source : http://www.ttlsa.com/html/1541.html

Reproduced in: https: //my.oschina.net/766/blog/211246

Guess you like

Origin blog.csdn.net/weixin_34174322/article/details/91547960