3

我正在尝试通过此链接将 MYSQL 集成到 Windows 7 上的 ElasticSearch 中

我已完成以下步骤:

1:

在 C 目录下载 & 解压 https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.3.4.zip

2:

在 CMD 上运行此命令 ./bin/plugin --install jdbc --url http://xbib.org/repository/org/xbib/elasticsearch/plugin/elasticsearch-river-jdbc/1.3.4.4/elasticsearch-river-jdbc -1.3.4.4-plugin.zip

3:

从 MYSQL 网站下载 MYSQL 连接器 mysql-connector-java-5.1.33.zip。

解压并复制 mysql-connector-java-5.1.33-bin.jar 文件。

将其放入 C:\elasticsearch-1.3.4\plugins\jdbc

我现在检查了 plugins 目录中有两个文件

  • elasticsearch-river-jdbc-1.3.4.4.jar

  • mysql-connector-java-5.1.33-bin

现在我试图在 CMD 上执行这个命令,我得到了错误

curl -XPUT 'localhost:9200/_river/jdbc-1.3.4.4-d2e33c3/_meta' -d '{
    "type" : "jdbc",
    "jdbc" : {
        "url" : "jdbc:mysql://localhost:3306/test",
        "user" : "root",
        "password" : "pass",
        "sql" : "select * from abc"
    }
}'

{
  "error": "MapperParsingException[failed to parse]; nested: JsonParseException[Unexpected character (''' (code 39)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')\n at [Source: [B@3cf756; line: 1, column:2]]; ",
  "status": 400
}

curl: (6) Could not resolve host: type; Host not found

curl: (6) Could not resolve host: :; No data record of requested type

curl: (6) Could not resolve host: jdbc,jdbc; No data record of requested type

curl: (6) Could not resolve host: :; No data record of requested type

curl: (3) [globbing] unmatched brace at pos 5

curl: (6) Could not resolve host: :; No data record of requested type

curl: (6) Could not resolve host: jdbc:mysql:; No data record of requested type

curl: (6) Could not resolve host: :; No data record of requested type

curl: (6) Could not resolve host: root,password; No data record of requested typ
e
curl: (6) Could not resolve host: :; No data record of requested type

curl: (6) Could not resolve host: pass,sql; No data record of requested type

curl: (6) Could not resolve host: :; No data record of requested type

curl: (6) Could not resolve host: select * from abc; No data record of requested type

MYSQL(5.5.37) 数据库 (test) 只包含一个表 (abc) 有两列 id(pk) 和 address (varchar)

我使用这个jdbc-1.3.4.4-d2e33c3名称作为 jdbc 驱动程序。我从这个链接得到这个名字。

http://localhost:9200/_nodes?settings=true&pretty=true

我已经对其进行了搜索,但找不到与 mysql 集成相关的任何问题。

我的问题仍然缺少任何东西,或者我做错了设置。?

4

4 回答 4

5

在 Windows 上,卷曲的行为不同。尝试使用 curl -XPUT "http://127.0.0.1:9200/index/type/id" -d "{ """attribute""" : """name""" }".带有这些三引号的 Try

于 2015-01-04T02:44:01.960 回答
0

使用Google Chrome 的Sense (Beta)扩展。它具有非常好的功能,例如自动完成、语法检查、语法突出显示、键盘快捷键和历史记录。

漫威是另一种选择。一个完整的免开发人员的 ES 管理控制台。它包含更新版本的 Sense,但它对生产节点不是免费的,并且具有此问题未提出的功能

于 2015-01-15T14:16:15.627 回答
0

当然,在 windows curl 行为不同..我的是 windows 7 64bit os 这对我有用..

curl -XPUT " http://localhost:9200/twitter/tweet/1 " -d "{""user"":""Rahul A Pawar"", ""message"":""这很有趣""} "

- 对键:值使用双引号。

于 2015-03-15T10:57:23.770 回答
0

是的,如果您的值包含空格,请记住用反斜杠 (\) 对其进行转义。而“””的意思是,你用另一个双引号转义一个双引号,有效地留下两个要处理。这一切都归结为以 Windows 方式转义字符。

于 2016-07-20T10:01:20.160 回答