Hello,
I encounter some difficulties to work with the "table" strategie in JDBC
river
I have installed :
ES 0.90.1 + JDBC 2.2.0
I realized the following steps:
step 1: Mysql tables creation
CREATE TABLE IF NOT EXISTS test_prd
(
_index
varchar(64) NOT NULL DEFAULT '',
_type
varchar(64) NOT NULL DEFAULT '',
_id
varchar(64) NOT NULL DEFAULT '',
source_timestamp
timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
source_operation
varchar(8) NOT NULL DEFAULT '',
prd_title
varchar(150) DEFAULT NULL,
cat_id
int(11) DEFAULT NULL,
PRIMARY KEY (_index
,_type
,_id
,source_timestamp
,source_operation
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
and
CREATE TABLE IF NOT EXISTS test_prd_ack
(
_index
varchar(64) NOT NULL DEFAULT '',
_type
varchar(64) NOT NULL DEFAULT '',
_id
varchar(64) NOT NULL DEFAULT '',
target_timestamp
timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE
CURRENT_TIMESTAMP,
target_operation
varchar(8) DEFAULT 'n/a',
target_failed
tinyint(1) DEFAULT NULL,
target_message
varchar(255) DEFAULT NULL,
PRIMARY KEY (_index
,_type
,_id
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Instead of the documentation, I added the following fields : _index, _type
and _id because the table "my_jdbc_river_ack" shows PRIMARY_KEY on absent
fields
(Create new page · jprante/elasticsearch-jdbc Wiki · GitHub)
Step 2:
I added two insert in the table "test_prd":
INSERT INTO pal
.test_prd
(_index
,_type
,_id
,source_timestamp
,source_operation
,prd_title
,cat_id
)
VALUES ('qml', 'card', '1',CURRENT_TIMESTAMP , 'create', 'title1', '100');
INSERT INTO pal
.test_prd
(_index
,_type
,_id
,source_timestamp
,source_operation
,prd_title
,cat_id
)
VALUES ('qml', 'card', '1',CURRENT_TIMESTAMP , 'create', 'title2', '101');
Step 3:
I created the mapping associated to the table "test_prd"
curl -XPUT 'http://localhost:9200/qml/card/_mapping' -d '
{
"card" : {
"properties" : {
"prd_title" : {"type" : "string"},
"cat_id" : {"type" : "integer"}
}
}
}'
Step 4:
I created the jdbc river using the "table" strategy:
curl -XPUT 'localhost:9200/_river/test_prd/_meta' -d '
{
"type" : "jdbc",
"jdbc" : {
"driver" : "com.mysql.jdbc.Driver",
"url" : "jdbc:mysql://localhost:3306/pal",
"user" : "root",
"password" : "abc",
"poll" : "10s",
"strategy" : "table"
},
"index" : {
"index" : "qml",
"type" : "card",
"bulk_size" : 100,
"max_bulk_requests" : 30,
"bulk_timeout" : "60s"
}
}'
The log file displays no error:
[2013-08-07 17:22:26,764][INFO ][cluster.metadata ] [Rankin,
Calvin] [_river] update_mapping [test_prd] (dynamic)
[2013-08-07 17:22:26,781][INFO ][river.jdbc ] [Rankin,
Calvin] [jdbc][test_prd] starting JDBC river: URL
[jdbc:mysql://localhost:3306/pal], driver [com.mysql.jdbc.Driver], strategy
[table], index [qml]/[card]
[2013-08-07 17:22:31,801][INFO ][cluster.metadata ] [Rankin,
Calvin] [_river] update_mapping [test_prd] (dynamic)
[2013-08-07 17:22:31,857][INFO
][org.elasticsearch.river.jdbc.strategy.simple.SimpleRiverFlow] next run,
waiting 10s
[2013-08-07 17:22:41,874][INFO
][org.elasticsearch.river.jdbc.strategy.simple.SimpleRiverFlow] next run,
waiting 10s
[2013-08-07 17:22:51,896][INFO
][org.elasticsearch.river.jdbc.strategy.simple.SimpleRiverFlow] next run,
waiting 10s
[2013-08-07 17:23:01,913][INFO
][org.elasticsearch.river.jdbc.strategy.simple.SimpleRiverFlow] next run,
waiting 10s
I have the feeling that nothing happens.
Nothing is updated in the tables "test_prd" and "test_prd_ack"
Nothing is inserted in elasticsearch:
curl -XGET 'localhost:9200/qml/card/_search'
{"took":5,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":}}
Please, do you have any idea where I make a mistake ?
thanks,
Christophe
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.