{"id":43224,"date":"2024-10-04T22:01:49","date_gmt":"2024-10-04T14:01:49","guid":{"rendered":"https:\/\/server.hk\/cnblog\/43224\/"},"modified":"2024-10-04T22:01:50","modified_gmt":"2024-10-04T14:01:50","slug":"centos-7-%e4%b8%8b-solr-6-6-0-%e5%96%ae%e6%a9%9f%e9%83%a8%e7%bd%b2","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/43224\/","title":{"rendered":"CentOS 7 \u4e0b Solr 6.6.0 \u55ae\u6a5f\u90e8\u7f72"},"content":{"rendered":"<h1 id=\"centos-7-%e4%b8%8b-solr-6-6-0-%e5%96%ae%e6%a9%9f%e9%83%a8%e7%bd%b2-bOLLLwarMJ\">CentOS 7 \u4e0b Solr 6.6.0 \u55ae\u6a5f\u90e8\u7f72<\/h1>\n<p>Apache Solr \u662f\u4e00\u500b\u958b\u6e90\u7684\u641c\u7d22\u5e73\u53f0\uff0c\u57fa\u65bc Apache Lucene\uff0c\u5ee3\u6cdb\u61c9\u7528\u65bc\u4f01\u696d\u641c\u7d22\u3001\u7db2\u7ad9\u641c\u7d22\u548c\u6578\u64da\u5206\u6790\u7b49\u5834\u666f\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5728 CentOS 7 \u74b0\u5883\u4e0b\u90e8\u7f72 Solr 6.6.0\uff0c\u4e26\u63d0\u4f9b\u8a73\u7d30\u7684\u6b65\u9a5f\u548c\u6ce8\u610f\u4e8b\u9805\u3002<\/p>\n<h2 id=\"%e5%89%8d%e6%9c%9f%e6%ba%96%e5%82%99-bOLLLwarMJ\">\u524d\u671f\u6e96\u5099<\/h2>\n<p>\u5728\u958b\u59cb\u4e4b\u524d\uff0c\u78ba\u4fdd\u4f60\u7684 CentOS 7 \u7cfb\u7d71\u5df2\u7d93\u66f4\u65b0\u5230\u6700\u65b0\u7248\u672c\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9032\u884c\u66f4\u65b0\uff1a<\/p>\n<pre><code>sudo yum update -y<\/code><\/pre>\n<p>\u63a5\u4e0b\u4f86\uff0c\u5b89\u88dd Java \u74b0\u5883\uff0c\u56e0\u70ba Solr \u9700\u8981 Java \u4f86\u904b\u884c\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88dd OpenJDK\uff1a<\/p>\n<pre><code>sudo yum install java-1.8.0-openjdk -y<\/code><\/pre>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u6aa2\u67e5 Java \u662f\u5426\u5b89\u88dd\u6210\u529f\uff1a<\/p>\n<pre><code>java -version<\/code><\/pre>\n<h2 id=\"%e4%b8%8b%e8%bc%89%e5%92%8c%e5%ae%89%e8%a3%9d-solr-bOLLLwarMJ\">\u4e0b\u8f09\u548c\u5b89\u88dd Solr<\/h2>\n<p>\u63a5\u4e0b\u4f86\uff0c\u4e0b\u8f09 Solr 6.6.0 \u7684\u5b89\u88dd\u5305\u3002\u53ef\u4ee5\u4f7f\u7528 wget \u547d\u4ee4\u4f86\u4e0b\u8f09\uff1a<\/p>\n<pre><code>wget http:\/\/archive.apache.org\/dist\/lucene\/solr\/6.6.0\/solr-6.6.0.tgz<\/code><\/pre>\n<p>\u4e0b\u8f09\u5b8c\u6210\u5f8c\uff0c\u89e3\u58d3\u7e2e\u5b89\u88dd\u5305\uff1a<\/p>\n<pre><code>tar xzf solr-6.6.0.tgz<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u9032\u5165\u89e3\u58d3\u5f8c\u7684\u76ee\u9304\uff1a<\/p>\n<pre><code>cd solr-6.6.0<\/code><\/pre>\n<p>\u63a5\u4e0b\u4f86\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u5b89\u88dd Solr\uff1a<\/p>\n<pre><code>sudo bin\/solr install -c mycollection<\/code><\/pre>\n<p>\u9019\u500b\u547d\u4ee4\u6703\u5275\u5efa\u4e00\u500b\u540d\u70ba &#8220;mycollection&#8221; \u7684\u7d22\u5f15\u96c6\u5408\u3002<\/p>\n<h2 id=\"%e5%95%9f%e5%8b%95-solr-bOLLLwarMJ\">\u555f\u52d5 Solr<\/h2>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u555f\u52d5 Solr\uff1a<\/p>\n<pre><code>bin\/solr start<\/code><\/pre>\n<p>\u555f\u52d5\u5f8c\uff0cSolr \u7684\u7ba1\u7406\u754c\u9762\u5c07\u6703\u5728 <a href=\"http:\/\/localhost:8983\/solr\" rel=\"nofollow noopener\" target=\"_blank\">http:\/\/localhost:8983\/solr<\/a> \u53ef\u7528\u3002\u4f60\u53ef\u4ee5\u5728\u700f\u89bd\u5668\u4e2d\u8a2a\u554f\u9019\u500b\u5730\u5740\u4f86\u6aa2\u67e5 Solr \u662f\u5426\u6b63\u5e38\u904b\u884c\u3002<\/p>\n<h2 id=\"%e9%85%8d%e7%bd%ae-solr-bOLLLwarMJ\">\u914d\u7f6e Solr<\/h2>\n<p>Solr \u7684\u914d\u7f6e\u6587\u4ef6\u4f4d\u65bc <code>solr\/mycollection\/conf\/<\/code> \u76ee\u9304\u4e0b\u3002\u4f60\u53ef\u4ee5\u6839\u64da\u9700\u8981\u4fee\u6539\u9019\u4e9b\u914d\u7f6e\u6587\u4ef6\uff0c\u4f8b\u5982 schema.xml \u548c solrconfig.xml\uff0c\u4ee5\u9069\u61c9\u4f60\u7684\u641c\u7d22\u9700\u6c42\u3002<\/p>\n<h3 id=\"%e6%b7%bb%e5%8a%a0%e6%95%b8%e6%93%9a-bOLLLwarMJ\">\u6dfb\u52a0\u6578\u64da<\/h3>\n<p>\u8981\u5411 Solr \u4e2d\u6dfb\u52a0\u6578\u64da\uff0c\u53ef\u4ee5\u4f7f\u7528 curl \u547d\u4ee4\u3002\u9996\u5148\uff0c\u5275\u5efa\u4e00\u500b JSON \u6587\u4ef6\uff0c\u5167\u5bb9\u5982\u4e0b\uff1a<\/p>\n<pre><code>{\n  \"add\": {\n    \"doc\": {\n      \"id\": \"1\",\n      \"title\": \"Hello World\",\n      \"content\": \"This is a test document.\"\n    }\n  }\n}<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5c07\u6578\u64da\u6dfb\u52a0\u5230 Solr \u4e2d\uff1a<\/p>\n<pre><code>curl http:\/\/localhost:8983\/solr\/mycollection\/update?commit=true -H 'Content-Type: application\/json' --data-binary @data.json<\/code><\/pre>\n<h2 id=\"%e7%9b%a3%e6%8e%a7%e5%92%8c%e7%ae%a1%e7%90%86-bOLLLwarMJ\">\u76e3\u63a7\u548c\u7ba1\u7406<\/h2>\n<p>Solr \u63d0\u4f9b\u4e86\u8c50\u5bcc\u7684\u7ba1\u7406\u754c\u9762\uff0c\u53ef\u4ee5\u7528\u4f86\u76e3\u63a7\u7d22\u5f15\u72c0\u614b\u3001\u67e5\u8a62\u6027\u80fd\u7b49\u3002\u4f60\u53ef\u4ee5\u5728\u7ba1\u7406\u754c\u9762\u4e2d\u67e5\u770b\u5404\u7a2e\u7d71\u8a08\u4fe1\u606f\uff0c\u4e26\u9032\u884c\u76f8\u61c9\u7684\u8abf\u6574\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-bOLLLwarMJ\">\u7e3d\u7d50<\/h2>\n<p>\u5728 CentOS 7 \u4e0a\u90e8\u7f72 Solr 6.6.0 \u662f\u4e00\u500b\u76f8\u5c0d\u7c21\u55ae\u7684\u904e\u7a0b\uff0c\u901a\u904e\u4e0a\u8ff0\u6b65\u9a5f\uff0c\u4f60\u53ef\u4ee5\u5feb\u901f\u642d\u5efa\u4e00\u500b\u529f\u80fd\u5f37\u5927\u7684\u641c\u7d22\u5e73\u53f0\u3002\u7121\u8ad6\u662f\u7528\u65bc\u4f01\u696d\u5167\u90e8\u641c\u7d22\u9084\u662f\u7db2\u7ad9\u641c\u7d22\uff0cSolr \u90fd\u80fd\u63d0\u4f9b\u9ad8\u6548\u7684\u89e3\u6c7a\u65b9\u6848\u3002\u5982\u679c\u4f60\u9700\u8981\u7a69\u5b9a\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u4f86\u904b\u884c\u4f60\u7684 Solr \u5be6\u4f8b\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\uff0c\u6eff\u8db3\u4e0d\u540c\u9700\u6c42\u7684\u7528\u6236\u3002\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\uff0c\u8acb\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to deploy Solr 6.6.0 on CentOS 7 in a single-server setup with step-by-step instructions for optimal performance.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-43224","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43224","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=43224"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43224\/revisions"}],"predecessor-version":[{"id":43225,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43224\/revisions\/43225"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=43224"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=43224"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=43224"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}