安裝與升級 > Windchill 安裝與組態 > 使用 PTC Solution Installer > 安裝 Windchill 解決方案 > 選用產品設定 > Windchill Index Search 安裝 > Windchill Index Search 安裝後組態 > 配置獨立索引搜尋伺服器 > 配置 Solr 的基本驗證 (獨立模式)
  
配置 Solr 的基本驗證 (獨立模式)
1. 使用下列指令停止 Solr︰
Windows
<INDEX_SEARCH_HOME>/bin/Index_Search_Server.bat stop
Unix
sh <INDEX_SEARCH_HOME>/bin/Index_Search_Server.sh stop
2. 開啟下列檔案:
<INDEX_SEARCH_HOME>/solr/server/etc/webdefault.xml
接著編輯內容,如下所示 (變更均反白顯示)︰
<security-constraint>
<web-resource-collection>
<web-resource-name>Disable TRACE</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Solr Realm</realm-name>
</login-config>
3. 開啟下列檔案:
<INDEX_SEARCH_HOME>/solr/server/etc/jetty.xml
在結尾處的 </Configure> 標籤之前新增下一個區段︰
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.security.HashLoginService">
<Set name="name">Solr Realm</Set>
<Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties</Set>
<Set name="refreshInterval">0</Set>
</New>
</Arg>
</Call>
4. 使用 Jetty 提供的下列公用程式產生加密格式的密碼︰
a. 開啟指令提示並導覽至 <INDEX_SEARCH_HOME>/solr/server
b. 使用純文字密碼作為引數執行下列指令︰
java -cp lib/jetty-util-9.2.13.v20150730.jar org.eclipse.jetty.util.security.Password <使用者名稱> <密碼>
例如,執行下列指令︰
java -cp lib/jetty-util-9.3.8.v20160314.jar org.eclipse.jetty.util.security.Password solr SolrRocks
導致下列輸出:
* 
PTC 建議使用此工具時以 CRYPT 作為最安全的加密選項。
5. 建立新檔案︰
<INDEX_SEARCH_HOME>/solr/server/etc/realm.properties
使用下列格式,新增在上一步中產生的加密密碼︰
<使用者名稱>: CRYPT:<加密密碼>,<角色>
例如:
solr: CRYPT:so3oR2FANmQ4Y,admin
6. 使用下列指令啟動 Solr︰
Windows
<INDEX_SEARCH_HOME>/bin/Index_Search_Server.bat start
Unix
sh <INDEX_SEARCH_HOME>/bin/Index_Search_Server.sh start
7. 開啟 Solr 管理員介面,並確認系統是否提示您輸入使用者名稱與密碼︰
http://<SOLR_HOSTNAME>:<SOLR_PORT>/solr
變更 Solr 使用者或密碼
您變更 Solr 使用者或密碼時,必須更新 Windchill 索引搜尋用戶端與伺服器。
1. 開啟 Windchill Shell 並執行下列指令來變更 Windchill Index Search 用戶端的密碼或使用者︰
xconfmanager -s wt.index.solrAdminUser=<New_User> -t codebase/WEB-INF/conf/index.solrAuth.properties -p
xconfmanager -s wt.index.solrAdminPassword=<New_Password> -t codebase/WEB-INF/conf/index.solrAuth.properties -p
2. 重新啟動 Windchill
3. 從指令提示下,導覽至 <INDEX_SEARCH_HOME>/bin,並執行下列指令來變更 Windchill Index Search 伺服器的密碼或使用者︰
Windows:
xconfmanager -s wt.index.server.solrAdminUser=<New_User> -t config/solrserver.properties -p
xconfmanager -s wt.index.server.solrAdminPassword=<New_Password> -t config/solrserver.properties -p
Unix:
sh xconfmanager -s wt.index.server.solrAdminUser=<New_User> -t config/solrserver.properties -p
sh xconfmanager -s wt.index.server.solrAdminPassword=<New_Password> -t config/solrserver.properties -p
4. 請依照上方所述的步驟更新 <INDEX_SEARCH_HOME>/solr/server/etc/realm.properties
5. 重新啟動 Solr。