Spring Data Jpa Apache ignite integration Spring Data in Sping Boot

dnph8jn4  于 2023-10-20  发布在  Spring
关注(0)|答案(1)|浏览(179)

最近,有一个新的要求,使用Apache的Apache浏览器。我想问一下Apache MySQL是否可以像MySQL一样通过Spring Data执行CRUD操作。我现在的想法是:
1.通过dbherver数据库工具连接Apache ignite,创建维度表和事实表。
1.在SpringBoot中集成Spring Data,创建表对应的实体和模型。

  1. SpringData连接到Apache ignite并通过Repository API提供Restful API。实际上,我不知道SpringData应该创建什么样的配置类:
(1) Ignite node connection configuration
 (2) Ignite thin client connection configuration

调试配置类期间发生各种错误。我想知道我的版本选择是否有问题。以下是我的版本:

SpringBoot-----2.7.5
 ignite-verson-----2.15.0
 ignite-spring-data-ext ---2.0.0
 Apache Ignite cluster (node1:47500,node2:47500,node3:47500,node4:47500,node5:47500)

求前辈给予指教!下面是我的pom:

<!-- Apache Ignite -->
        <dependency>
            <groupId>org.apache.ignite</groupId>
            <artifactId>ignite-core</artifactId>
            <version>${ignite.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.ignite</groupId>
            <artifactId>ignite-indexing</artifactId>
            <version>${ignite.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.ignite</groupId>
            <artifactId>ignite-spring-boot-autoconfigure-ext</artifactId>
            <version>${ignite-autoconfigure.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.ignite</groupId>
            <artifactId>ignite-spring-data-ext</artifactId>
            <version>${ignite-spring-data.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-commons</artifactId>
        </dependency>
        

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>${h2.version}</version>
        </dependency>

下面是我的配置类:

@Configuration
@EnableIgniteRepositories
public class IgniteConfig {

    @Bean
    public Ignite igniteInstance() {
        IgniteConfiguration cfg = new IgniteConfiguration();
        cfg.setClientMode(true);

        TcpDiscoverySpi spi = new TcpDiscoverySpi();
        TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
        ipFinder.setAddresses(Collections.singletonList("node1:47500"));
        spi.setIpFinder(ipFinder);
        cfg.setDiscoverySpi(spi);

        return Ignition.start(cfg);
    }
}

有一次被困在这里:

2023-06-13 22:07:07.654  INFO 37540 --- [           main] o.a.i.i.p.cluster.ClusterProcessor       : Cluster ID and tag has been read from metastorage: null
2023-06-13 22:07:07.659  INFO 37540 --- [           main] o.a.i.i.cluster.IgniteClusterImpl        : Shutdown policy was updated [oldVal=null, newVal=null]
2023-06-13 22:07:07.662  INFO 37540 --- [           main] .a.i.i.p.q.s.IgniteStatisticsManagerImpl : Statistics usage state was changed from null to null
krugob8w

krugob8w1#

下面是我的SpringBoot/SpringData应用程序中的pom文件:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.12</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.gridgain.ps.k8s</groupId>
    <artifactId>ignite-client</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>igniteclient</name>
    <description>Spring Boot Ignite Client</description>
    <properties>
        <java.version>11</java.version>
        <gridgain.version>8.8.30</gridgain.version>
        <ignite-spring-data-ext.version>2.0.0</ignite-spring-data-ext.version>
    </properties>
    <repositories>
         <repository>
             <id>GridGain External Repository</id>
             <url>https://www.gridgainsystems.com/nexus/content/repositories/external</url>
         </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.ignite</groupId>
            <artifactId>ignite-spring-data-ext</artifactId>
            <version>${ignite-spring-data-ext.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-commons</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.ignite</groupId>
          <artifactId>ignite-spring-boot-thin-client-autoconfigure-ext</artifactId>
          <version>1.0.0</version>
        </dependency>
        <dependency>
             <groupId>org.gridgain</groupId>
             <artifactId>ignite-core</artifactId>
             <version>${gridgain.version}</version>
         </dependency>
        <dependency>
            <groupId>org.gridgain</groupId>
            <artifactId>ignite-kubernetes</artifactId>
            <version>${gridgain.version}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

如果愿意,您可以将对GridGain的引用切换为对Gridite的引用。

相关问题