Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| kb:neo4j [2016/02/08 11:09] – yehuda | kb:neo4j [2022/01/03 16:03] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== NEO4J ====== | ====== NEO4J ====== | ||
| - | High availability to neo4j: Clients -> HAproxy -> neo4j servers | + | [[kb: |
| - | + | [[kb:neo4j:Code snippits|Neo4j code snippits]] | |
| - | + | ||
| - | ===== Linux preformance ===== | + | |
| - | <file | / | + | |
| - | neo4j | + | |
| - | neo4j | + | |
| - | </ | + | |
| - | + | ||
| - | + | ||
| - | <code bash> | + | |
| - | echo ' | + | |
| - | cat / | + | |
| - | noop [deadline] cfq | + | |
| - | </ | + | |
| - | + | ||
| - | + | ||
| - | + | ||
| - | ===== Neo4J configuration ===== | + | |
| - | <file | / | + | |
| - | ################################################################ | + | |
| - | # Neo4j | + | |
| - | # | + | |
| - | # neo4j-server.properties - runtime operational settings | + | |
| - | # | + | |
| - | ################################################################ | + | |
| - | + | ||
| - | # | + | |
| - | # Server configuration | + | |
| - | # | + | |
| - | + | ||
| - | # location of the database directory | + | |
| - | org.neo4j.server.database.location=data/ | + | |
| - | + | ||
| - | # Low-level graph engine tuning file | + | |
| - | org.neo4j.server.db.tuning.properties=conf/ | + | |
| - | + | ||
| - | # Database mode | + | |
| - | # Allowed values: | + | |
| - | # HA - High Availability | + | |
| - | # SINGLE - Single mode, default. | + | |
| - | # To run in High Availability mode, configure the neo4j.properties config file, then uncomment this line: | + | |
| - | org.neo4j.server.database.mode=HA | + | |
| - | + | ||
| - | # Let the webserver only listen on the specified IP. Default is localhost (only | + | |
| - | # accept local connections). Uncomment to allow any connection. Please see the | + | |
| - | # security section in the neo4j manual before modifying this. | + | |
| - | org.neo4j.server.webserver.address=0.0.0.0 | + | |
| - | + | ||
| - | # Require (or disable the requirement of) auth to access Neo4j | + | |
| - | dbms.security.auth_enabled=true | + | |
| - | + | ||
| - | # | + | |
| - | # HTTP Connector | + | |
| - | # | + | |
| - | + | ||
| - | # http port (for all data, administrative, | + | |
| - | org.neo4j.server.webserver.port=7474 | + | |
| - | + | ||
| - | # | + | |
| - | # HTTPS Connector | + | |
| - | # | + | |
| - | + | ||
| - | # Turn https-support on/off | + | |
| - | org.neo4j.server.webserver.https.enabled=true | + | |
| - | + | ||
| - | # https port (for all data, administrative, | + | |
| - | org.neo4j.server.webserver.https.port=7473 | + | |
| - | + | ||
| - | # Certificate location (auto generated if the file does not exist) | + | |
| - | dbms.security.tls_certificate_file=conf/ | + | |
| - | + | ||
| - | # Private key location (auto generated if the file does not exist) | + | |
| - | dbms.security.tls_key_file=conf/ | + | |
| - | + | ||
| - | # Internally generated keystore (don't try to put your own | + | |
| - | # keystore there, it will get deleted when the server starts) | + | |
| - | org.neo4j.server.webserver.https.keystore.location=data/ | + | |
| - | + | ||
| - | # Comma separated list of JAX-RS packages containing JAX-RS resources, one | + | |
| - | # package name for each mountpoint. The listed package names will be loaded | + | |
| - | # under the mountpoints specified. Uncomment this line to mount the | + | |
| - | # org.neo4j.examples.server.unmanaged.HelloWorldResource.java from | + | |
| - | # neo4j-server-examples under / | + | |
| - | # http:// | + | |
| - | # | + | |
| - | + | ||
| - | + | ||
| - | # | + | |
| - | # HTTP logging configuration | + | |
| - | # | + | |
| - | + | ||
| - | # HTTP logging is disabled. HTTP logging can be enabled by setting this | + | |
| - | # property to ' | + | |
| - | org.neo4j.server.http.log.enabled=false | + | |
| - | + | ||
| - | # Logging policy file that governs how HTTP log output is presented and | + | |
| - | # archived. Note: changing the rollover and retention policy is sensible, but | + | |
| - | # changing the output format is less so, since it is configured to use the | + | |
| - | # ubiquitous common log format | + | |
| - | org.neo4j.server.http.log.config=conf/ | + | |
| - | + | ||
| - | # | + | |
| - | # Administration client configuration | + | |
| - | # | + | |
| - | + | ||
| - | # location of the servers round-robin database directory. possible values: | + | |
| - | # - absolute path like /var/rrd | + | |
| - | # - path relative to the server working directory like data/rrd | + | |
| - | # - commented out, will default to the database data directory. | + | |
| - | org.neo4j.server.webadmin.rrdb.location=data/ | + | |
| - | + | ||
| - | + | ||
| - | # | + | |
| - | # Neo4j Browser configuration | + | |
| - | # | + | |
| - | + | ||
| - | # Whitelist of hosts for the Neo4j Browser to be allowed to fetch content from. | + | |
| - | # Set to ' | + | |
| - | dbms.browser.remote_content_hostname_whitelist=http:// | + | |
| - | + | ||
| - | # Allow outgoing connections from Neo4j Browser. | + | |
| - | dbms.security.allow_outgoing_browser_connections=true | + | |
| - | + | ||
| - | </ | + | |
| - | < | + | |
| - | ################################################################ | + | |
| - | # Neo4j | + | |
| - | # | + | |
| - | # neo4j.properties - database tuning parameters | + | |
| - | # | + | |
| - | ################################################################ | + | |
| - | + | ||
| - | # Enable this to be able to upgrade a store from an older version. | + | |
| - | # | + | |
| - | + | ||
| - | # The amount of memory to use for mapping the store files, in bytes (or | + | |
| - | # kilobytes with the ' | + | |
| - | # If Neo4j is running on a dedicated server, then it is generally recommended | + | |
| - | # to leave about 2-4 gigabytes for the operating system, give the JVM enough | + | |
| - | # heap to hold all your transaction state and query context, and then leave the | + | |
| - | # rest for the page cache. | + | |
| - | # The default page cache memory assumes the machine is dedicated to running | + | |
| - | # Neo4j, and is heuristically set to 50% of RAM minus the max Java heap size. | + | |
| - | # | + | |
| - | dbms.security.auth_enabled=false | + | |
| - | # Enable this to specify a parser other than the default one. | + | |
| - | # | + | |
| - | + | ||
| - | # Set the root directory for use with file URLs (`file:/// | + | |
| - | # If enabled, file URLs will refer to locations inside the `data/ | + | |
| - | # directory. I.e. `file:/// | + | |
| - | # `data/ | + | |
| - | # | + | |
| - | + | ||
| - | # Keep logical logs, helps debugging but uses more disk space, enabled for | + | |
| - | # legacy reasons To limit space needed to store historical logs use values such | + | |
| - | # as: "7 days" or "100M size" instead of " | + | |
| - | # | + | |
| - | + | ||
| - | # Enable shell server so that remote clients can connect via Neo4j shell. | + | |
| - | # | + | |
| - | # The network interface IP the shell will listen on (use 0.0.0.0 for all interfaces). | + | |
| - | # | + | |
| - | # The port the shell will listen on, default is 1337. | + | |
| - | # | + | |
| - | + | ||
| - | # Enable online backups to be taken from this database. | + | |
| - | online_backup_enabled=true | + | |
| - | + | ||
| - | # Port to listen to for incoming backup requests. | + | |
| - | online_backup_server=192.168.168.33: | + | |
| - | + | ||
| - | + | ||
| - | # Uncomment and specify these lines for running Neo4j in High Availability mode. | + | |
| - | # See the High availability | + | |
| - | # http://neo4j.com/ | + | |
| - | + | ||
| - | # ha.server_id is the number of each instance in the HA cluster. It should be | + | |
| - | # an integer (e.g. 1), and should be unique for each cluster instance. | + | |
| - | ha.server_id=1 | + | |
| - | + | ||
| - | # ha.initial_hosts is a comma-separated list (without spaces) of the host:port | + | |
| - | # where the ha.cluster_server of all instances will be listening. Typically | + | |
| - | # this will be the same for all cluster instances. | + | |
| - | ha.initial_hosts=192.168.168.33: | + | |
| - | + | ||
| - | # IP and port for this instance to listen on, for communicating cluster status | + | |
| - | # information iwth other instances (also see ha.initial_hosts). The IP | + | |
| - | # must be the configured IP address for one of the local interfaces. | + | |
| - | ha.cluster_server=192.168.168.33: | + | |
| - | + | ||
| - | # IP and port for this instance to listen on, for communicating transaction | + | |
| - | # data with other instances (also see ha.initial_hosts). The IP | + | |
| - | # must be the configured IP address for one of the local interfaces. | + | |
| - | ha.server=192.168.168.33: | + | |
| - | + | ||
| - | # The interval at which slaves will pull updates from the master. Comment out | + | |
| - | # the option to disable periodic pulling of updates. Unit is seconds. | + | |
| - | ha.pull_interval=10 | + | |
| - | + | ||
| - | # Amount of slaves the master will try to push a transaction to upon commit | + | |
| - | # (default is 1). The master will optimistically continue and not fail the | + | |
| - | # transaction even if it fails to reach the push factor. Setting this to 0 will | + | |
| - | # increase write performance when writing through master but could potentially | + | |
| - | # lead to branched data (or loss of transaction) if the master goes down. | + | |
| - | # | + | |
| - | + | ||
| - | # Strategy the master will use when pushing data to slaves (if the push factor | + | |
| - | # is greater than 0). There are two options available " | + | |
| - | # " | + | |
| - | # (highest first) improving performance since the slaves only have to cache up | + | |
| - | # one transaction at a time. | + | |
| - | # | + | |
| - | + | ||
| - | # Policy for how to handle branched data. | + | |
| - | # | + | |
| - | + | ||
| - | # Clustering timeouts | + | |
| - | # Default timeout. | + | |
| - | # | + | |
| - | + | ||
| - | # How often heartbeat messages should be sent. Defaults to ha.default_timeout. | + | |
| - | # | + | |
| - | + | ||
| - | # Timeout for heartbeats between cluster members. Should be at least twice that of ha.heartbeat_interval. | + | |
| - | # | + | |
| - | + | ||
| - | </ | + | |
| - | + | ||
| - | ==== HAproxy ==== | + | |
| - | + | ||
| - | < | + | |
| - | global | + | |
| - | daemon | + | |
| - | maxconn 384 | + | |
| - | + | ||
| - | defaults | + | |
| - | mode http | + | |
| - | timeout connect 5000ms | + | |
| - | timeout client 50000ms | + | |
| - | timeout server 50000ms | + | |
| - | + | ||
| - | frontend http-in | + | |
| - | bind *:7777 | + | |
| - | default_backend neo4j | + | |
| - | + | ||
| - | backend neo4j | + | |
| - | option httpchk GET / | + | |
| - | server s1 192.168.168.33: | + | |
| - | server s2 192.168.168.34: | + | |
| - | server s3 192.168.168.35: | + | |
| - | + | ||
| - | listen admin | + | |
| - | bind *:7770 | + | |
| - | stats enable | + | |
| - | </ | + | |
| - | + | ||
| - | <code bash> | + | |
| - | yum install haproxy | + | |
| - | haproxy -f / | + | |
| - | </ | + | |
| - | + | ||
| - | See: http:// | + | |