Unsubscribe

2018-05-19 Thread



Unsubscribe

2018-05-03 Thread
Unsubscribe


发送自 Windows 10 版邮件应用



答复: Liquibase with Ignite?

2018-03-25 Thread
Maybe beause there is no callback fucntion for 
org.apache.ignite.IgniteJdbcThinDriver.



I use a class mock liquibase, hope can help you:



/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

package com.samples.vehicles.ignite.init;



import com.samples.vehicles.common.DomainUtils;



import java.util.ArrayList;

import java.util.Collections;

import java.util.HashMap;

import java.util.List;

import java.util.Map;

import java.util.UUID;



import org.slf4j.Logger;

import org.slf4j.LoggerFactory;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.context.annotation.Bean;

import org.springframework.context.annotation.Configuration;

import org.springframework.context.annotation.DependsOn;

import org.springframework.jdbc.core.JdbcTemplate;



/**

* @author lenovo

*/

@Configuration

public class ILikeLiquibase {



private final Logger log = LoggerFactory.getLogger(this.getClass());

@Autowired

private JdbcTemplate jdbcTemplate;



private final String lock = UUID.randomUUID().toString();

private final List sqlList = new ArrayList<>();

private final Map sqlMap = new HashMap<>();



//add new script here

private void loadScripts() {



addSql("20180314WG03", "DROP TABLE IF EXISTS alarm_record_file;");

addSql("20180314WG04", "CREATE TABLE alarm_record_file(fileossid 
VARCHAR PRIMARY KEY,alarm_id VARCHAR,"

+ "file_type Long, channel Long, create_time TIMESTAMP);");



addSql("20180314WG05", "DROP TABLE IF EXISTS gps;");

addSql("20180314WG06", "CREATE TABLE gps(id Long PRIMARY KEY 
,vehicle_id Long, time TIMESTAMP,driver_id Long,"

+ "status Long,lng Long,lat Long,height Long,speed 
Long,direction Long,wirelessstrength Long,gnns Long,mileage Long);");



addSql("20180323DXM01", "DROP TABLE IF EXISTS alarm_record_file;");

addSql("20180323DXM02", "CREATE TABLE alarm_record_file(fileossid 
VARCHAR,alarm_id VARCHAR,"

+ "file_type Long, channel Long, create_time TIMESTAMP, PRIMARY 
KEY(fileossid,alarm_id));");



}



private void mergeScripts() {

jdbcTemplate.query("select id, sql from Public.sqlScriptLog",

(rs, row) -> {

String id = rs.getString("id");

String sql = rs.getString("sql");

if (sqlMap.containsKey(id) && !sqlMap.get(id).equals(sql)) {

throw new RuntimeException("Sql script changed id:" + 
id);

}

sqlList.remove(id);

return null;

});

}



private void addSql(String id, String sql) {

if (sqlList.contains(id)) {

throw new RuntimeException("duplicate sql script");

}

sqlList.add(id);

sqlMap.put(id, sql);

}



private void createTable() {

jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS sqlScriptLog("

+ " id VARCHAR PRIMARY KEY, sql VARCHAR)"

+ " WITH \"backups=2\";");

jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS sqlScriptLock("

+ " id VARCHAR PRIMARY KEY, lock LONG)"

+ " WITH \"backups=2\";");

}



private void checkLock() {

Integer nLock = jdbcTemplate.queryForObject("select count(*) from 
sqlScriptLock",

Integer.class);

if (nLock == 0) {

addLock();

}

Integer myLock = jdbcTemplate.queryForObject("select count(*) from 
sqlScriptLock "

+ "where id = ? ", new Object[]{lock}, Integer.class);

if (myLock == 0) {

log.info("SqlScriptManagement waiting for lock ...");

try {

Thread.sleep(1L);

} catch (Exception e) {

}

checkLock();

}



}



private void addLock() {

log.info("SqlScriptManagement get lock ...");

jdbcTemplate.update("insert into sqlScriptLock (id, lock) values (?, 
?)",

new Object[]{lock, 1});

}



private void removeLock() {

log.info("SqlScriptManagement remove lock ...");

jdbcTemplate.update("delete from sqlScriptLock "

+ "where id = ?", new Object[]{lock});

}



private void runSql() {

Collections.sort(sqlList);

log.info("SqlScriptManagement run scripts:" + 
DomainUtils.bean2json(sqlList));

sqlList.forEach(id -> {

log.info("Running sql script id:" + id);

jdbcTemplate.execute(sqlMap.get(id));

jdbcTemplate.update("insert into sqlScriptLog(id, sql) VALUES 
(?,?)",

ps -> {

ps.setString(1, id);


答复: Ignite cluster always throw java.lang.NoClassDefFoundError

2018-03-17 Thread
Hi , ann body know how to fix java.lang.NoClassDefFoundError ?  It happened 
random in ignite cluster.

I have dependency and config in spring boot application.

@Bean
public Ignite igniteServerMode() throws IgniteCheckedException {
// Apache Ignite node configuration.
IgniteConfiguration igniteConfiguration = new IgniteConfiguration();

// Ignite persistence configuration.
DataStorageConfiguration dataStorageConfiguration = new 
DataStorageConfiguration();

//set dataStorageConfiguration
{
// Enabling the writes throttling.
dataStorageConfiguration.setWriteThrottlingEnabled(true);

//prsist data region
DataRegionConfiguration dataRegionConfiguration = 
dataStorageConfiguration.getDefaultDataRegionConfiguration();
// Enabling the persistence.
dataRegionConfiguration.setPersistenceEnabled(true);
//set persist region name

dataRegionConfiguration.setName(igniteProperties.getPersistRegionName());
// Increasing the buffer size to 1 GB.
dataRegionConfiguration.setCheckpointPageBufferSize(1024 * 1024 * 
1024);

// Creating a new cache region.
DataRegionConfiguration cacheRegionConfiguration = new 
DataRegionConfiguration();
// Region name.

cacheRegionConfiguration.setName(igniteProperties.getCacheRegionName());
// Setting initial RAM size 100M
cacheRegionConfiguration.setInitialSize(100 * 1024 * 1024);
// Setting maximum RAM size 1G
cacheRegionConfiguration.setMaxSize(1024 * 1024 * 1024);
// Setting the data region configuration.

dataStorageConfiguration.setDataRegionConfigurations(cacheRegionConfiguration);

if (!igniteProperties.getDataPath().equalsIgnoreCase("local")) {
//set work path

igniteConfiguration.setWorkDirectory(igniteProperties.getDataPath() + workPath);
//set store path

dataStorageConfiguration.setStoragePath(igniteProperties.getDataPath() + 
storePath);

dataStorageConfiguration.setWalPath(igniteProperties.getDataPath() + walPath);

dataStorageConfiguration.setWalArchivePath(igniteProperties.getDataPath() + 
walArchivePath);
}

// Applying settings.

igniteConfiguration.setDataStorageConfiguration(dataStorageConfiguration);
}

//set cluster config
{
//add cluster config
TcpDiscoverySpi tcpDiscoverSpi = new TcpDiscoverySpi();
TcpDiscoveryJdbcIpFinder ipFinder = new TcpDiscoveryJdbcIpFinder();
// Configure your DataSource.
ipFinder.setDataSource(igniteSpiDatasource);
tcpDiscoverSpi.setIpFinder(ipFinder);

tcpDiscoverSpi.setNetworkTimeout(igniteProperties.getNetworkTimeout());
igniteConfiguration.setDiscoverySpi(tcpDiscoverSpi);
}

//set sql client port
{
//add sql connection configuration
ClientConnectorConfiguration clientConnectorConfiguration = new 
ClientConnectorConfiguration();
clientConnectorConfiguration.setPort(igniteProperties.getSqlPort());

igniteConfiguration.setClientConnectorConfiguration(clientConnectorConfiguration);
}

//start ignite
Ignite ignite = IgniteSpring.start(igniteConfiguration, context);
ignite.active(true);
return ignite;
}

  
org.apache.ignite
ignite-core
${ignite.version}


org.apache.ignite
ignite-spring
${ignite.version}


org.apache.ignite
ignite-indexing
${ignite.version}


org.apache.ignite
ignite-slf4j
${ignite.version}

  
ch.qos.logback
logback-classic


发送自 Windows 10 版邮件<https://go.microsoft.com/fwlink/?LinkId=550986>应用

________
发件人: 王 刚 <wanggang1...@live.cn>
发送时间: Thursday, March 15, 2018 4:29:44 PM
收件人: user@ignite.apache.org
主题: Ignite cluster always throw java.lang.NoClassDefFoundError


Hi, guys. I meat an issue in ignite cluster. I am using ignite in spring-boot 
1.5.8 by add ignite-core dependency 2.30. And the cluster use JDBC DiscoverySpi 
as cluster ipFinder.

If i kill spring-boot-ignite by chance, and try to restart, ignite alaws throws 
an NoClassDefFoundError: java.lang.NoClassDefFoundError: 
ch/qos/logback/classic/spi/ThrowableProxy or other class like 
org/springframework/http/ResponseEntity.  But I’am sure the class is in jar 
file. And after i remove all the files in /store/node, ignite can successfully 
start.

These are my pom file, configuration file and log file.




发送自 Windows 10 版邮件<

Ignite cluster always throw java.lang.NoClassDefFoundError

2018-03-15 Thread

Hi, guys. I meat an issue in ignite cluster. I am using ignite in spring-boot 
1.5.8 by add ignite-core dependency 2.30. And the cluster use JDBC DiscoverySpi 
as cluster ipFinder.

If i kill spring-boot-ignite by chance, and try to restart, ignite alaws throws 
an NoClassDefFoundError: java.lang.NoClassDefFoundError: 
ch/qos/logback/classic/spi/ThrowableProxy or other class like 
org/springframework/http/ResponseEntity.  But I’am sure the class is in jar 
file. And after i remove all the files in /store/node, ignite can successfully 
start.

These are my pom file, configuration file and log file.




发送自 Windows 10 版邮件应用


http://maven.apache.org/POM/4.0.0; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd;>
4.0.0

com.samples.vehicles
ignite
jar
0.3.0-SNAPSHOT

vehicles-ignite
ignite search engine


com.samples
vehicles
0.3.0-SNAPSHOT



UTF-8
UTF-8
1.8
2.4.0 
2.12.0


  

com.samples.vehicles
common
0.3.0-SNAPSHOT


org.springframework.cloud
spring-cloud-starter-feign


org.springframework.cloud
spring-cloud-starter-eureka


org.springframework.boot
spring-boot-starter-web
  

org.springframework.boot
spring-boot-starter-jdbc


org.springframework.boot
spring-boot-configuration-processor


org.apache.camel
camel-spring-boot-starter


org.apache.camel
camel-kafka


org.apache.ignite
ignite-core
${ignite.version}


org.apache.ignite
ignite-spring
${ignite.version}


org.apache.ignite
ignite-indexing
${ignite.version}


org.apache.ignite
ignite-slf4j
${ignite.version}

  
ch.qos.logback
logback-classic


mysql
mysql-connector-java


org.projectlombok
lombok
true


commons-dbutils
commons-dbutils
1.1


com.h2database
h2






org.springframework.boot
spring-boot-maven-plugin

true



org.apache.maven.plugins
maven-compiler-plugin
3.7.0

1.8
1.8




 



IgniteConfig.java
Description: IgniteConfig.java


ignite.log
Description: ignite.log