Springboot整合BBoss-Elasticsearch启动一直连127.0.0.1(解决方法)

壤驷志学
2023-12-01

官方解决方法

点我跳转

idea启动正常,打包启动报错127.0.0.1连不上看这里↓↓↓

必须使用这种方式,不要用ElasticSearchHelper,打包会有问题

@Autowired
private BBossESStarter bbossESStarter;

正常启动,读取到配置的application.yml

spring:
  application:
    name: xxx
  elasticsearch:
    bboss:
      elasticPassword: 123456
      elasticUser: elastic
      elasticsearch:
        dateFormat: yyyy.MM.dd
        discoverHost: false
        rest:
          hostNames: 192.168.3.51:9200
        scrollBlockedWaitTimeout: 0
        scrollThreadCount: 200
        scrollThreadQueue: 200
        showTemplate: false
        sliceScrollBlockedWaitTimeout: 0
        sliceScrollThreadCount: 100
        sliceScrollThreadQueue: 100
        timeZone: Asia/Shanghai
      http:
        connectionRequestTimeout: 5000
        customHttpRequestRetryHandler: org.frameworkset.spi.remote.http.ConnectionResetHttpRequestRetryHandler
        defaultMaxPerRoute: 200
        hostnameVerifier:
        keepAlive: 3600000
        keyPassword:
        keystore:
        maxHeaderCount: 200
        maxLineLength: -1
        maxTotal: 400
        retryTime: 1
        retryInterval: 1000
        soKeepAlive: false
        soReuseAddress: false
        staleConnectionCheckEnabled: false
        timeToLive: 3600000
        timeoutConnection: 5000
        timeoutSocket: 5000
        validateAfterInactivity: 2000
      dslfile:
        refreshInterval: -1

pom.xml

解决启动日志报错

        <!--ElasticsearchBboss启动类引入-->
        <dependency>
            <groupId>com.bbossgroups.plugins</groupId>
            <artifactId>bboss-elasticsearch-rest-jdbc</artifactId>
            <version>${bboss.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>slf4j-log4j12</artifactId>
                    <groupId>org.slf4j</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.bbossgroups.plugins</groupId>
            <artifactId>bboss-elasticsearch-spring-boot-starter</artifactId>
            <version>${bboss.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>slf4j-log4j12</artifactId>
                    <groupId>org.slf4j</groupId>
                </exclusion>
            </exclusions>
        </dependency>

官方说用这种获取配置

    @Autowired
    private BBossESStarter bbossESStarter;

这种好像也可以

    ClientInterface restClientUtil = ElasticSearchHelper.getRestClientUtil();

如果还是一直连127.0.0.1:9200,或许尝试修改下删除bboss配置再添加,我的就是什么也没动,又好了,或者新建一个demo,只保留springboot整合bboss的代码,然后测试.

注意elasticsearch的依赖不要多引用其他的,只用bboss整合的两个就够了

 类似资料: