Loaded data from Java in to ignite and reading from php pdo_odb - "[unixODBC]Can not receive message header"

167 views Asked by At

I have setup ignite and pdo_odbc. I am able to load data into ignite and everything is working from java.

    Ignite ignite = Ignition.start("examples/config/example-ignite.xml");
    IgniteConfiguration iCfg = ignite.configuration();
    OdbcConfiguration odbcCfg = new OdbcConfiguration();
    iCfg.setOdbcConfiguration(odbcCfg);

    // Prices
    CacheJdbcPojoStoreFactory<PriceKey, Price> pricesPojoStoreFactory = new CacheJdbcPojoStoreFactory<>();
    pricesPojoStoreFactory.setDataSourceFactory(new PricesMysqlDataSourceFactory());

    CacheConfiguration<PriceKey, Price> priceCfg = PriceCacheConfig.cache("PriceCache", pricesPojoStoreFactory);
    try (IgniteCache<PriceKey, Price> priceCache = ignite.getOrCreateCache(priceCfg)) {

    }

I need to access data from PHP so I have setup pdo_odbc.

$ignite = $dbh = new \PDO('odbc:Apache Ignite');
$ignite->prepare('select * from Price');

I am getting exception

[PDOException]
SQLSTATE[HYT01] SQLConnect: 0 [unixODBC]Can not receive message header

This is my ~/.odbc.ini configurations

[AgnitePdoOdbc]
description=Agnite pdo odbc
driver=Apache Ignite
ADDRESS=127.0.0.1:48100
CACHE=PersonCache

I tried configuring different ports but for some ports I was not able to connect to host. For 48100 it seems I am able to connect but pdo_odbc is not able to fetch data.

The error in log

[13:41:32,385][SEVERE][shmem-communication-acceptor-#14%null%][TcpCommunicationSpi] Failed to process incoming shared memory connection: invalid stream header: 0B000000

Log when ignite started

[15:21:51,438][INFO][main][IgniteKernal] 

>>>    __________  ________________  
>>>   /  _/ ___/ |/ /  _/_  __/ __/  
>>>  _/ // (7 7    // /  / / / _/    
>>> /___/\___/_/|_/___/ /_/ /___/   
>>> 
>>> ver. 1.8.0#20161205-sha1:9ca40dbe
>>> 2016 Copyright(C) Apache Software Foundation
>>> 
>>> Ignite documentation: http://ignite.apache.org

[15:21:51,439][INFO][main][IgniteKernal] Config URL: file:/home/vishal/install/apache-ignite/examples/config/example-ignite.xml
[15:21:51,439][INFO][main][IgniteKernal] Daemon mode: off
[15:21:51,440][INFO][main][IgniteKernal] OS: Linux 4.4.0-53-generic amd64
[15:21:51,440][INFO][main][IgniteKernal] OS user: vishal
[15:21:51,441][INFO][main][IgniteKernal] PID: 30007
[15:21:51,441][INFO][main][IgniteKernal] Language runtime: Java Platform API Specification ver. 1.8
[15:21:51,441][INFO][main][IgniteKernal] VM information: Java(TM) SE Runtime Environment 1.8.0_91-b14 Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.91-b14
[15:21:51,444][INFO][main][IgniteKernal] VM total memory: 3.5GB
[15:21:51,444][INFO][main][IgniteKernal] Remote Management [restart: off, REST: on, JMX (remote: off)]
[15:21:51,444][INFO][main][IgniteKernal] IGNITE_HOME=/home/vishal/install/apache-ignite
[15:21:51,444][INFO][main][IgniteKernal] VM arguments: [-Dfile.encoding=UTF-8]
[15:21:51,444][INFO][main][IgniteKernal] Configured caches ['ignite-marshaller-sys-cache', 'ignite-sys-cache', 'ignite-atomics-sys-cache']
[15:21:51,445][WARNING][main][IgniteKernal] Peer class loading is enabled (disable it in production for performance and deployment consistency reasons)
[15:21:51,447][INFO][main][IgniteKernal] 3-rd party licenses can be found at: /home/vishal/install/apache-ignite/libs/licenses
[15:21:51,447][WARNING][pub-#6%null%][GridDiagnostic] Initial heap size is 250MB (should be no less than 512MB, use -Xms512m -Xmx512m).
[15:21:51,482][INFO][main][IgnitePluginProcessor] Configured plugins:
[15:21:51,482][INFO][main][IgnitePluginProcessor]   ^-- None
[15:21:51,482][INFO][main][IgnitePluginProcessor] 
[15:21:51,572][INFO][main][TcpCommunicationSpi] IPC shared memory server endpoint started [port=48100, tokDir=/home/vishal/install/apache-ignite/work/ipc/shmem/c38b841c-db6f-4755-8754-ef35fce092ef-30007]
[15:21:51,572][INFO][main][TcpCommunicationSpi] Successfully bound shared memory communication to TCP port [port=48100, locHost=0.0.0.0/0.0.0.0]
[15:21:51,582][INFO][main][TcpCommunicationSpi] Successfully bound to TCP port [port=47100, locHost=0.0.0.0/0.0.0.0]
[15:21:51,741][WARNING][main][NoopCheckpointSpi] Checkpoints are disabled (to enable configure any GridCheckpointSpi implementation)
[15:21:51,757][WARNING][main][GridCollisionManager] Collision resolution is disabled (all jobs will be activated upon arrival).
[15:21:51,759][WARNING][main][NoopSwapSpaceSpi] Swap space is disabled. To enable use FileSwapSpaceSpi.
[15:21:51,760][INFO][main][IgniteKernal] Security status [authentication=off, tls/ssl=off]
[15:21:51,936][WARNING][main][IgniteH2Indexing] Serialization of Java objects in H2 was enabled.
[15:21:51,972][INFO][main][GridTcpRestProtocol] Command protocol successfully started [name=TCP binary, host=0.0.0.0/0.0.0.0, port=11212]
[15:21:52,098][INFO][main][GridJettyRestProtocol] Command protocol successfully started [name=Jetty REST, host=/0.0.0.0, port=8080]
[15:21:52,123][INFO][main][IgniteKernal] Non-loopback local IPs: 10.0.3.1, 192.168.0.220, 192.168.1.107, fe80:0:0:0:3067:5bff:fe14:b410%lxcbr0, fe80:0:0:0:effa:8f97:a461:d619%enp2s0, fe80:0:0:0:f80d:53ff:fe5e:5b4e%tap0, fe80:0:0:0:fc35:87ff:fe00:d1d%vethO7PVH6
[15:21:52,123][INFO][main][IgniteKernal] Enabled local MACs: 64006A07DD7E, FA0D535E5B4E, FE3587000D1D
[15:21:52,146][INFO][main][TcpDiscoverySpi] Successfully bound to TCP port [port=47500, localHost=0.0.0.0/0.0.0.0, locNodeId=c38b841c-db6f-4755-8754-ef35fce092ef]
[15:21:53,534][INFO][main][GridCacheProcessor] Started cache [name=ignite-sys-cache, mode=REPLICATED]
[15:21:53,542][INFO][main][GridCacheProcessor] Started cache [name=ignite-atomics-sys-cache, mode=PARTITIONED]
[15:21:53,553][INFO][main][GridCacheProcessor] Started cache [name=ignite-marshaller-sys-cache, mode=REPLICATED]
[15:21:53,601][INFO][exchange-worker-#25%null%][GridCachePartitionExchangeManager] Skipping rebalancing (nothing scheduled) [top=AffinityTopologyVersion [topVer=1, minorTopVer=0], evt=NODE_JOINED, node=c38b841c-db6f-4755-8754-ef35fce092ef]
[15:21:53,645][INFO][main][IgniteKernal] Performance suggestions for grid  (fix if possible)
[15:21:53,645][INFO][main][IgniteKernal] To disable, set -DIGNITE_PERFORMANCE_SUGGESTIONS_DISABLED=true
[15:21:53,645][INFO][main][IgniteKernal]   ^-- Disable peer class loading (set 'peerClassLoadingEnabled' to false)
[15:21:53,645][INFO][main][IgniteKernal]   ^-- Disable grid events (remove 'includeEventTypes' from configuration)
[15:21:53,645][INFO][main][IgniteKernal] 
[15:21:53,645][INFO][main][IgniteKernal] To start Console Management & Monitoring run ignitevisorcmd.{sh|bat}
[15:21:53,646][INFO][main][IgniteKernal] 
[15:21:53,646][INFO][main][IgniteKernal] 

>>> +----------------------------------------------------------------------+
>>> Ignite ver. 1.8.0#20161205-sha1:9ca40dbeb7d559fcb299bdb6f5c90cdf8ce7e533
>>> +----------------------------------------------------------------------+
>>> OS name: Linux 4.4.0-53-generic amd64
>>> CPU(s): 4
>>> Heap: 3.5GB
>>> VM name: 30007@vishal-OptiPlex-3020
>>> Local node [ID=C38B841C-DB6F-4755-8754-EF35FCE092EF, order=1, clientMode=false]
>>> Local node addresses: [192.168.0.220/0:0:0:0:0:0:0:1%lo, 10.0.3.1/10.0.3.1, 192.168.1.107/127.0.0.1, /192.168.0.220, /192.168.1.107]
>>> Local ports: TCP:8080 TCP:11212 TCP:47100 UDP:47400 TCP:47500 TCP:48100 

[15:21:53,647][INFO][main][GridDiscoveryManager] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=3.5GB]
[15:21:57,143][INFO][exchange-worker-#25%null%][GridCacheProcessor] Started cache [name=TimeseriesCache, mode=PARTITIONED]
[15:21:57,154][INFO][exchange-worker-#25%null%][GridCachePartitionExchangeManager] Skipping rebalancing (nothing scheduled) [top=AffinityTopologyVersion [topVer=1, minorTopVer=1], evt=DISCOVERY_CUSTOM_EVT, node=c38b841c-db6f-4755-8754-ef35fce092ef]
[15:21:57,196][INFO][main][CacheJdbcPojoStore] Started load cache [cache=TimeseriesCache, keyType=java.lang.String]
[15:21:58,798][INFO][main][CacheJdbcPojoStore] Finished load cache: TimeseriesCache
[15:21:59,330][INFO][exchange-worker-#25%null%][GridCachePartitionExchangeManager] Skipping rebalancing (nothing scheduled) [top=AffinityTopologyVersion [topVer=1, minorTopVer=2], evt=DISCOVERY_CUSTOM_EVT, node=c38b841c-db6f-4755-8754-ef35fce092ef]
[15:22:02,286][INFO][exchange-worker-#25%null%][GridCacheProcessor] Started cache [name=PriceCache, mode=PARTITIONED]
[15:22:02,295][INFO][exchange-worker-#25%null%][GridCachePartitionExchangeManager] Skipping rebalancing (nothing scheduled) [top=AffinityTopologyVersion [topVer=1, minorTopVer=3], evt=DISCOVERY_CUSTOM_EVT, node=c38b841c-db6f-4755-8754-ef35fce092ef]
[15:22:02,304][INFO][exchange-worker-#25%null%][GridCachePartitionExchangeManager] Skipping rebalancing (nothing scheduled) [top=AffinityTopologyVersion [topVer=1, minorTopVer=4], evt=DISCOVERY_CUSTOM_EVT, node=c38b841c-db6f-4755-8754-ef35fce092ef]
[15:22:02,331][WARNING][exchange-worker-#25%null%][CacheOsStoreManager] <RatioCache> Persistence store is configured, but both read-through and write-through are disabled. This configuration makes sense if the store implements loadCache method only. If this is the case, ignore this warning. Otherwise, fix the configuration for the cache: RatioCache
[15:22:02,331][INFO][exchange-worker-#25%null%][GridCacheProcessor] Started cache [name=RatioCache, mode=PARTITIONED]
[15:22:02,352][INFO][exchange-worker-#25%null%][GridCachePartitionExchangeManager] Skipping rebalancing (nothing scheduled) [top=AffinityTopologyVersion [topVer=1, minorTopVer=5], evt=DISCOVERY_CUSTOM_EVT, node=c38b841c-db6f-4755-8754-ef35fce092ef]
[15:22:03,392][INFO][ignite-update-notifier-timer][GridUpdateNotifier] Your version is up to date.
[15:22:06,291][INFO][exchange-worker-#25%null%][GridCachePartitionExchangeManager] Skipping rebalancing (nothing scheduled) [top=AffinityTopologyVersion [topVer=1, minorTopVer=6], evt=DISCOVERY_CUSTOM_EVT, node=c38b841c-db6f-4755-8754-ef35fce092ef]
[15:22:06,293][WARNING][exchange-worker-#25%null%][CacheOsStoreManager] <AggregateCache> Persistence store is configured, but both read-through and write-through are disabled. This configuration makes sense if the store implements loadCache method only. If this is the case, ignore this warning. Otherwise, fix the configuration for the cache: AggregateCache
[15:22:06,294][INFO][exchange-worker-#25%null%][GridCacheProcessor] Started cache [name=AggregateCache, mode=PARTITIONED]
[15:22:06,307][INFO][exchange-worker-#25%null%][GridCachePartitionExchangeManager] Skipping rebalancing (nothing scheduled) [top=AffinityTopologyVersion [topVer=1, minorTopVer=7], evt=DISCOVERY_CUSTOM_EVT, node=c38b841c-db6f-4755-8754-ef35fce092ef]
[15:22:07,552][INFO][exchange-worker-#25%null%][GridCachePartitionExchangeManager] Skipping rebalancing (nothing scheduled) [top=AffinityTopologyVersion [topVer=1, minorTopVer=8], evt=DISCOVERY_CUSTOM_EVT, node=c38b841c-db6f-4755-8754-ef35fce092ef]
1

There are 1 answers

0
isapego On

In your log there is no messages from OdbcProcessor, which should be there if it is properly configured and started. It seems like there is some other service waiting on TCP port 48100, so when ODBC driver tries to connect to it it gets disconnected instantly. Share your node configuration so I can tell if its configured right.

UPDATE: According to error in the log you are trying to connect to CommunicationSpi, which is wrong. Instead you should configure OdbcProcessor as described here and connect to it.