我试图在Ubuntu 12.04上安装Elasticsearch 1.0.1。到目前为止,我已经完成了:
首先我删除了旧的elasticsearch 0.90包
sudo dpkg -r elasticsearch
然后cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.0.1.deb
sudo dpkg -i elasticsearch-1.0.1.deb
最后一步结果如下
(Reading database ... 57341 files and directories currently installed.)
Preparing to replace elasticsearch 1.0.1 (using elasticsearch-1.0.1.deb) ...
Unpacking replacement elasticsearch ...
Setting up elasticsearch (1.0.1) ...
chown: cannot access `/etc/elasticsearch/*': No such file or directory
所以我在/etc/elasticsearch中创建了一个虚拟文件,然后执行
sudo chmod 777 /etc/elasticsearch
现在当我运行
sudo dpkg -i elasticsearch-1.0.1.deb
我(Reading database ... 57341 files and directories currently installed.)
Preparing to replace elasticsearch 1.0.1 (using elasticsearch-1.0.1.deb) ...
Unpacking replacement elasticsearch ...
Setting up elasticsearch (1.0.1) ...
Processing triggers for ureadahead ...
但是/etc/elasticsearch
没有出现但是我确实得到了一个文件夹出现在
/usr/share/elasticsearch
有以下内容
bin core-signatures.txt lib NOTICE.txt README.textile
从这里,如果我运行
sudo bin/elasticsearch
我log4j:WARN无法找到记录器(节点)的appeners。log4j:WARN请正确初始化log4j系统。log4j:WARN更多信息请参见http://logging.apache.org/log4j/1.2/faq.html#noconfig
并继续运行
如果我打开一个新窗口并运行
curl -XGET 'localhost:9200'
我{
"status" : 200,
"name" : "Volstagg",
"version" : {
"number" : "1.0.1",
"build_hash" : "5c03844e1978e5cc924dab2a423dc63ce881c42b",
"build_timestamp" : "2014-02-25T15:52:53Z",
"build_snapshot" : false,
"lucene_version" : "4.6"
},
"tagline" : "You Know, for Search"
}
所以它看起来正在运行,我可以用
填充搜索(symfony2 foselasticabundance)php app/console fos:elastica:populate
但是如果我进行搜索,没有找到任何结果。
所以问题是,它是否安装了,为什么不能正常工作?
我正在使用github.com/FriendsOfSymfony/FOSElasticaBundle与Symfony2 PHP框架。bundle的配置如下:
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
products:
client: default
types:
product:
mappings:
name: { boost: 5 }
commonName: { boost: 5 }
sku: { boost: 3 }
description:
isRemedy:
countries:
type: "nested"
properties:
code: ~
book:
type: "nested"
properties:
author: ~
isbn: ~
persistence:
driver: orm
model: HeliosCoreBundleEntityProduct
provider: ~
finder: ~
listener: ~
elastica_to_model_transformer:
ignore_missing: true
当我填充时,我没有得到任何错误,但仍然无法搜索。
谢谢
不知道为什么不能搜索,但有一些事情可以检查。在这一页说明配置文件的路径。
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/setup-service.html初始化脚本放在/etc/init.D/elasticsearch就是这样期望它。配置文件位于/etc/default/elasticsearch .
检查是否一切正常运行如下查询:/_cluster/健康/_nodes/统计
希望有帮助
我已经通过使用旧方法安装了elasticsearch- 1.0.1
cd ~
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.0.1.tar.gz
tar -xf elasticsearch-1.0.1.tar.gz
cd /usr/local/
sudo mkdir elasticsearch
cd elasticsearch
cd ~
sudo mv elasticsearch-1.0.1 /usr/local/elasticsearch/
现在如果我运行
curl -XGET 'localhost:9200'
返回{
"status" : 200,
"name" : "Mister Jip",
"version" : {
"number" : "1.0.1",
"build_hash" : "5c03844e1978e5cc924dab2a423dc63ce881c42b",
"build_timestamp" : "2014-02-25T15:52:53Z",
"build_snapshot" : false,
"lucene_version" : "4.6"
},
"tagline" : "You Know, for Search"
}
curl -XGET 'localhost:9200/_cluster/health?漂亮'
现在返回:
{
"cluster_name" : "elasticsearch",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 2,
"number_of_data_nodes" : 2,
"active_primary_shards" : 5,
"active_shards" : 10,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 0
}
我可以填充我的搜索索引,一切都很好。我仍然不知道为什么我不能安装包安装程序,所以我原来的问题是没有答案的。