→阿童沐

財富==支撐一個人生存多長時間的能力!

导航

<服务器>在Resin3.1.12中配置Solr1.4.1=

将Resin解压,并找到配置文件所在目录中的resin.conf文件:

具体配置文件如下:

  1 <!--
  2    - Resin 3.1 configuration file.
  3   -->
  4 <resin xmlns="http://caucho.com/ns/resin"
  5        xmlns:resin="http://caucho.com/ns/resin/core">
  6 
  7   <!-- adds all .jar files under the resin/lib directory -->
  8   <class-loader>
  9     <tree-loader path="${resin.home}/ext-lib"/>
 10     <tree-loader path="${resin.root}/ext-lib"/>
 11 
 12     <tree-loader path="${resin.home}/lib"/>
 13     <tree-loader path="${resin.root}/lib"/>
 14   </class-loader>
 15 
 16   <!--
 17      - Management configuration
 18      -
 19      - Remote management requires at least one enabled admin user.
 20     -->
 21   <management path="${resin.root}/admin">
 22     <user name="admin" password="password" disable="true"/>
 23 
 24     <resin:if test="${resin.professional}">
 25       <deploy-service/>
 26       <jmx-service/>
 27       <log-service/>
 28       <xa-log-service/>
 29     </resin:if>
 30   </management>
 31 
 32   <!--
 33      - Logging configuration for the JDK logging API.
 34     -->
 35   <log name="" level="info" path="stdout:"
 36        timestamp="[%H:%M:%S.%s] {%{thread}} "/>
 37 
 38   <!--
 39      - 'info' for production
 40      - 'fine' or 'finer' for development and troubleshooting
 41     -->
 42   <logger name="com.caucho" level="info"/>
 43 
 44   <logger name="com.caucho.java" level="config"/>
 45   <logger name="com.caucho.loader" level="config"/>
 46 
 47   <!--
 48      - For production sites, change dependency-check-interval to something
 49      - like 600s, so it only checks for updates every 10 minutes.
 50     -->
 51   <dependency-check-interval>2s</dependency-check-interval>
 52 
 53   <!--
 54      - SMTP server for sending mail notifications
 55     -->
 56   <system-property mail.smtp.host="127.0.0.1"/>
 57   <system-property mail.smtp.port="25"/>
 58 
 59   <!--
 60      - Sets the default character encoding to utf-8
 61      -
 62      - <character-encoding>utf-8</character-encoding>
 63     -->
 64 
 65   <!--
 66      - You can change the compiler to "javac", "eclipse" or "internal".
 67     -->
 68   <javac compiler="internal" args="-source 1.5"/>
 69 
 70   <!-- Security providers.
 71      - <security-provider>
 72      -    com.sun.net.ssl.internal.ssl.Provider
 73      - </security-provider>
 74     -->
 75 
 76   <!-- Uncomment to use Resin's XML implementations
 77      -
 78      - <system-property javax.xml.parsers.DocumentBuilderFactory
 79      -                 ="com.caucho.xml.parsers.XmlDocumentBuilderFactory"/>
 80      - <system-property javax.xml.parsers.SAXParserFactory
 81      -                 ="com.caucho.xml.parsers.XmlSAXParserFactory"/>
 82     -->
 83 
 84   <cluster id="app-tier">
 85     <!-- sets the content root for the cluster, relative to server.root -->
 86     <root-directory>.</root-directory>
 87 
 88     <server-default>
 89       <!-- The http port -->
 90       <http address="*" port="8983"/>
 91 
 92       <!--
 93          - SSL port configuration:
 94          -
 95          - <http address="*" port="8443">
 96          -   <openssl>
 97          -     <certificate-file>keys/gryffindor.crt</certificate-file>
 98          -     <certificate-key-file>keys/gryffindor.key</certificate-key-file>
 99          -     <password>test123</password>
100          -   </openssl>
101          - </http>
102         -->
103 
104       <!--
105          - The JVM arguments
106         -->
107       <jvm-arg>-Xmx256m</jvm-arg>
108       <jvm-arg>-Xss1m</jvm-arg>
109       <jvm-arg>-Xdebug</jvm-arg>
110       <jvm-arg>-Dcom.sun.management.jmxremote</jvm-arg>
111 
112       <!--
113          - Uncomment to enable admin heap dumps
114          - <jvm-arg>-agentlib:resin</jvm-arg>
115         -->
116 
117       <!--
118          - arguments for the watchdog process
119         -->
120       <watchdog-jvm-arg>-Dcom.sun.management.jmxremote</watchdog-jvm-arg>
121       <watchdog-port>6600</watchdog-port>
122 
123       <!--
124          - Configures the minimum free memory allowed before Resin
125          - will force a restart.
126         -->
127       <memory-free-min>1M</memory-free-min>
128 
129       <!-- Maximum number of threads. -->
130       <thread-max>256</thread-max>
131 
132       <!-- Configures the socket timeout -->
133       <socket-timeout>65s</socket-timeout>
134 
135       <!-- Configures the keepalive -->
136       <keepalive-max>128</keepalive-max>
137       <keepalive-timeout>15s</keepalive-timeout>
138 
139       <!--
140          - If starting bin/resin as root on Unix, specify the user name
141          - and group name for the web server user.
142          -
143          - <user-name>resin</user-name>
144          - <group-name>resin</group-name>
145         -->
146     </server-default>
147 
148     <!-- define the servers in the cluster -->
149     <server id="" address="127.0.0.1" port="6800"/>
150 
151     <!--
152        - Configures the persistent store for single-server or clustered
153        - in Resin professional.
154       -->
155     <resin:if test="${resin.professional}">
156       <persistent-store type="cluster">
157         <init path="session"/>
158       </persistent-store>
159     </resin:if>
160 
161     <!--
162        - For security, use a different cookie for SSL sessions.
163        - <ssl-session-cookie>SSL_JSESSIONID</ssl-session-cookie>
164       -->
165 
166     <!--
167        - Enables the cache (available in Resin Professional) 
168       -->
169     <resin:if test="${resin.professional}">
170       <cache path="cache" memory-size="64M">
171         <!-- Vary header rewriting for IE -->
172         <rewrite-vary-as-private/>
173       </cache>
174     </resin:if>
175 
176     <!--
177        - Enables periodic checking of the server status and
178        - check for deadlocks..
179        -
180        - All servers can add <url>s to be checked.
181       -->
182     <resin:if test="${resin.professional}">
183       <ping>
184         <!-- <url>http://localhost:8080/test-ping.jsp</url> -->
185       </ping>
186     </resin:if>
187 
188     <!--
189        - Defaults applied to each web-app.
190       -->
191     <web-app-default>
192       <prologue>
193         <!--
194            - Extension library for common jar files.  The ext is safe
195            - even for non-classloader aware jars.  The loaded classes
196            - will be loaded separately for each web-app, i.e. the class
197            - itself will be distinct.
198           -->
199         <class-loader>
200           <tree-loader path="${resin.root}/ext-webapp-lib"/>
201         </class-loader>
202 
203         <!--
204            - Enable EL expressions in Servlet and Filter init-param
205           -->
206         <allow-servlet-el/>
207       </prologue>
208       
209       <!--
210          - Sets timeout values for cacheable pages, e.g. static pages.
211         -->
212       <cache-mapping url-pattern="/" expires="5s"/>
213       <cache-mapping url-pattern="*.gif" expires="60s"/>
214       <cache-mapping url-pattern="*.jpg" expires="60s"/>
215       <cache-mapping url-pattern="*.png" expires="60s"/>
216 
217       <!--
218          - for security, disable session URLs by default.
219         -->
220       <session-config>
221         <enable-url-rewriting>false</enable-url-rewriting>
222       </session-config>
223 
224       <!--
225          - For security, set the HttpOnly flag in cookies.
226          - <cookie-http-only/>
227         -->
228 
229       <!--
230          - Some JSP packages have incorrect .tld files.  It's possible to
231          - set validate-taglib-schema to false to work around these packages.
232         -->
233         <jsp>
234           <validate-taglib-schema>true</validate-taglib-schema>
235           <fast-jstl>true</fast-jstl>
236         </jsp>
237     </web-app-default>
238 
239     <!-- includes the app-default for default web-app behavior -->
240     <resin:import path="${resin.home}/conf/app-default.xml"/>
241 
242     <!--
243        - Sample database pool configuration
244        -
245        - The JDBC name is java:comp/env/jdbc/test
246          <database>
247            <jndi-name>jdbc/mysql</jndi-name>
248            <driver type="org.gjt.mm.mysql.Driver">
249              <url>jdbc:mysql://localhost:3306/test</url>
250              <user></user>
251              <password></password>
252             </driver>
253             <prepared-statement-cache-size>8</prepared-statement-cache-size>
254             <max-connections>20</max-connections>
255             <max-idle-time>30s</max-idle-time>
256           </database>
257       -->
258 
259     <!--
260        - Default host configuration applied to all virtual hosts.
261       -->
262     <host-default>
263       <!--
264          - With another web server, like Apache, this can be commented out
265          - because the web server will log this information.
266         -->
267       <access-log path="logs/access.log" 
268             format='%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"'
269             rollover-period="1W"/>
270 
271       <!-- creates the webapps directory for .war expansion -->
272       <web-app-deploy path="webapps"/>
273 
274       <!-- creates the deploy directory for .ear expansion -->
275       <ear-deploy path="deploy">
276         <ear-default>
277           <ejb-server>
278             <config-directory>WEB-INF</config-directory>
279           </ejb-server>
280         </ear-default>
281       </ear-deploy>
282 
283       <!-- creates the deploy directory for .rar expansion -->
284       <resource-deploy path="deploy"/>
285     </host-default>
286 
287     <!-- configures a deployment directory for virtual hosts -->
288     <host-deploy path="hosts">
289       <host-default>
290         <resin:import path="host.xml" optional="true"/>
291       </host-default>
292     </host-deploy>
293 
294     <!-- configures the default host, matching any host name -->
295     <host id="" root-directory=".">
296       <!--
297          - configures an explicit root web-app matching the
298          - webapp's ROOT
299         -->
300       <web-app id="/" root-directory="webapps/ROOT"/>
301 
302       <web-app id="/resin-admin" root-directory="${resin.home}/php/admin">
303         <!--
304            - Administration application /resin-admin
305           -->
306         <prologue>
307           <resin:set var="resin_admin_external" value="false"/>
308           <resin:set var="resin_admin_insecure" value="true"/>
309         </prologue>
310       </web-app>
311       
312       <!--
313         solr configuration here
314       -->
315       <web-app id="/solr" document-directory="webapps/solr" archive-path="solr/solr.war" character-encoding="utf-8">
316         <env-entry>
317             <env-entry-name>solr/home</env-entry-name>
318             <env-entry-type>java.lang.String</env-entry-type>
319             <env-entry-value>D:/Program/DeveloperTools/resin-3.1.12/solr/solr-home</env-entry-value>
320         </env-entry>
321       </web-app>
322     </host>
323   </cluster>
324 
325   <!--
326      - Configuration for the web-tier/load-balancer
327     -->
328   <resin:if test="${resin.professional}">
329     <cluster id="web-tier">
330       <server-default>
331         <!-- The http port -->
332         <http address="*" port="9080"/>
333       </server-default>
334 
335       <server id="web-a" address="127.0.0.1" port="6700"/>
336 
337       <cache path="cache" memory-size="64M"/>
338 
339       <host id="">
340         <web-app id="/">
341 
342            <rewrite-dispatch>
343              <load-balance regexp="" cluster="app-tier"/>
344            </rewrite-dispatch>
345 
346         </web-app>
347       </host>
348     </cluster>
349   </resin:if>
350 </resin>

 

 

请注意Line 315- Line 321行的配置代码:

这里是配置solr应用的主要代码,这样子的配置要比Tomcat配置合理多了,因为Tomcat配置solr/home环境变量需要在<tomcat-home>/conf/Catalina/localhost/solr.xml中配置(如果没有solr.xml还需要新建一个).

注意:Line315 document-directory="webapps/solr" archive-path="solr/solr.war" 中可使用相对路径,但是设置<env-entry-value>D:/Program/DeveloperTools/resin-3.1.12/solr/solr-home</env-entry-value>

时貌似要使用绝对路径,因为这里设置的是环境变量,否则Resin服务器启动的时候会报告RuntimeException

以下是我搜集的一些链接:

http://qinglangee.iteye.com/blog/666471

http://www.ixpub.net/thread-642180-1-1.html

posted on 2012-05-02 12:33  阿童沐  阅读(866)  评论(0)    收藏  举报