Changes between Version 38 and Version 39 of apachesolr
- Timestamp:
- Jun 6, 2011, 11:42:36 AM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
apachesolr
v38 v39 9 9 == Security == 10 10 11 Solr does not come with a generic authentification mechanism. The Solr installation on mirabal uses a two-level security system. The connection between the web and the Solr server is secured by ssh against attacks from the web. The instances (denoted by <sitename>) on the Solr server are protected by random admin paths (denoted by <sitepath>) from one another. Random admin paths are generated by 'core_' followed by 12 {{{ 13 pwgen --secure 30 14 }}} 11 Solr does not come with a generic authentification mechanism. The Solr installation on mirabal uses a two-level security system. The connection between the web and the Solr server is secured by ssh against attacks from the web. The instances (denoted by $SITENAME) on the Solr server are protected by random admin paths (denoted by $SITEPATH) from one another. The random admin paths are generated by 'core_' followed by {{{pwgen -1 --secure 30}}} 15 12 16 13 == Reliability == 17 14 18 Sometimes Solr crashes Tomcat if there are too many requests at once. So we use [http://mmonit.com/monit/ monit] to monitor Solr and restart Tomcat [http://yoodey.com/how-auto-restart-tomcat-6-overload-using-monit-ubuntu-1010-maverick automatically] if it crashed. 19 20 We are currently using [http://www.harding.motd.ca/autossh/ autossh] to connect the web servers and the Solr server. We'll eventually either combine autossh with [http://www.gnu.org/software/screen/ Gnu screen] or replace it with ssh monitored by [http://smarden.org/runit/ runit] in the future. 15 The ssh connections between the web and the Solr server is supervised by [http://smarden.org/runit/ runit]. If there is a problem ssh will end the connection and runit will restart ssh. Sometimes Solr crashes Tomcat if there are too many requests at once. So we use [http://mmonit.com/monit/ monit] to monitor Solr and restart Tomcat [http://yoodey.com/how-auto-restart-tomcat-6-overload-using-monit-ubuntu-1010-maverick automatically] if it crashed. 21 16 22 17 == Web site Administrators == … … 27 22 * lumumba.mayfirst.org 28 23 * june.mayfirst.org 29 * bethemedia.org.uk (209.44.112.176)24 * sojourner.mayfirst.org 30 25 * at.indymedia.org 26 * bethemedia.org.uk 31 27 32 28 If your primary server is not listed, please open a [/newticket ticket] or [wiki:chat contact the support team] to request having your primary host added. … … 48 44 Solr host name: localhost 49 45 Solr port: 9080 50 Solr path: /solr/ <sitepath>46 Solr path: /solr/$SITEPATH 51 47 }}} 52 48 … … 67 63 === On the primary server === 68 64 69 Create a new user on the server (called $SERVER from now on) with the user name solr-ssh and add:65 Create a new user on the server (called $SERVERNAME with host $SERVERHOST from now on) with the user name solr-ssh and add: 70 66 71 67 {{{ … … 73 69 }}} 74 70 75 to the new user's ~/.ssh/authorized_keys file. mirabal will connect to $SERVERwith these credentials and provide an ssh tunnel to the Apache Solr server.71 to the new user's ''~/.ssh/authorized_keys'' file. mirabal will connect to $SERVERHOST with these credentials and provide an ssh tunnel to the Apache Solr server. 76 72 77 73 === On Mirabal === 78 74 79 There are two things to do on mirabal.mayfirst.org: add a ssh tunnel to $SERVER and create a new Apache Solr site in Apache Tomcat. 75 There are two things to do on mirabal.mayfirst.org: add a ssh tunnel to $SERVER and create a new Apache Solr instance in Apache Tomcat. 76 77 Below is an explanation of the high-level script. If you are interested in the details please have a look at the [wiki:apachesolrdetails] 80 78 81 79 ==== Create SSH tunnel ==== … … 83 81 Log as solr-ssh into $SERVER from solr-ssh on mirabal.mayfirst.org 84 82 {{{ 85 sudo -u solr-ssh ssh -p $SERVER_SSH_PORT solr-ssh@$SERVER 83 sudo -u solr-ssh ssh -p $SERVER_SSH_PORT solr-ssh@$SERVERHOST 86 84 }}} 87 85 End the connection with ''exit'' 88 86 89 On mirabal, add a SSH tunnel by adding the login credentials (-p $SERVER_SSH_PORT solr-ssh@$SERVER) to87 On mirabal, add a SSH tunnel by using ''solr_addssh'' (see ''solr_addssh --man'' for help and more options) 90 88 {{{ 91 /etc/default/solr-autossh 92 }}} 93 94 Restart the script with 95 {{{ 96 service solr-autossh restart 89 solr_addssh -p $SERVER_SSH_PORT $SERVERNAME $SERVERHOST 97 90 }}} 98 91 … … 101 94 Check with 102 95 {{{ 103 s ervice solr-autossh status96 sv status solr-ssh-$SERVERNAME 104 97 }}} 105 that the tunnel exists .98 that the tunnel exists (i.e. the status is ''up''). 106 99 107 Log as solr-ssh into $SERVER and download with100 Log as solr-ssh into $SERVERHOST and try 108 101 {{{ 109 wgetlocalhost:9080102 curl http://localhost:9080 110 103 }}} 111 t he Apache Tomcat welcome page from mirabal.mayfirst.org.104 to see the Apache Tomcat welcome page from mirabal.mayfirst.org. 112 105 113 106 ==== Create new Solr configuration ==== 114 107 115 Use {{{solr_addsite}}} to create a new Solr instance :108 Use {{{solr_addsite}}} to create a new Solr instance names $SITENAME: 116 109 117 {{{solr_addsite <sitename>}}}110 {{{solr_addsite $SITENAME}}} 118 111 119 The script will output the Solr admin path for the new site. 120 121 ===== Explanation of solr_addsite ===== 122 123 You can access the man page via 124 125 {{{solr_addsite --man}}} 126 127 The script creates a directory for the new Solr core 128 {{{ 129 mkdir /usr/share/solr/<sitename> 130 }}} 131 132 Then it copies an existing Solr core 133 {{{ 134 cp -a /etc/solr/testsite /etc/solr/<sitename> 135 }}} 136 137 If you need a different configuration than the [http://drupal.org/project/apachesolr Apache Solr Drupal module] provides you probably have to change at least ''schema.xml'' and ''solrconfig.xml'' in {{{/etc/solr/<sitename>/conf}}}. 138 139 And it changes the symbolic link to the new configuration directory 140 {{{ 141 ln -sf /etc/solr/<sitename>/conf /usr/share/solr/<sitename> 142 }}} 143 144 Afterwards, the script creates a new data directory 145 {{{ 146 mkdir /var/lib/solr/data/<sitename> 147 }}} 148 149 It changes ownership to tomcat6 150 {{{ 151 chown -R tomcat6:tomcat6 /var/lib/solr/data 152 }}} 153 154 And it changes the symbolic link to the new data directory 155 {{{ 156 ln -sf /var/lib/solr/data/<sitename> /usr/share/solr/<sitename>/data 157 }}} 158 159 Finally, the script registers a new core 160 {{{ 161 <core name="<sitepath>" instanceDir="<sitename>" /> 162 }}} 163 in 164 {{{ 165 /etc/solr/solr-multicore.xml 166 }}} 112 The script will output the Solr admin path (the $SITEPATH) for the new Solr instance. 167 113 168 114 ==== Restart Apache Tomcat ==== … … 177 123 Check that the new core is accessible with: 178 124 {{{ 179 curl http://localhost:8080/solr/ <sitepath>/admin/.125 curl http://localhost:8080/solr/$SITEPATH/admin/. 180 126 }}}