solr 全量数据迁移


solr服务开启、停止、重启:
cd到solr的bin目录 ./solr start | restart | stop -force

./solr start -p 9923 -force
./solr stop -p 9923 -force
./solr restart -p 9923 -force
solr 更改端口的方法:
https://blog.youkuaiyun.com/faryang/article/details/52852446
https://www.cnblogs.com/Lxiaojiang/p/6737323.html

solr 全量数据迁移方法:(数据结构及数据全部迁移出来了)
例子:
1、源数据源地址:/mydata/solr/solr-6.9.0/server/solr/batch
2、目标数据源地址:/mydata/solr/solr-6.9.0/server/solr/batch
3、将源数据源所在文件夹copy覆盖目标数据源所在文件夹中
迁移数据:
http://xxxx.xx.xx.xx:9212/solr/bag/replication?command=backup
http://xxxx.xx.xx.xx:9212/solr/batch/replication?command=backup
http://xxxx.xx.xx.xx:9212/solr/batchDetail/replication?command=backup
http://xxxx.xx.xx.xx:9212/solr/cotton/replication?command=backup

scp -r snapshot.20191014081917984  root@xxxx.xx.xx.xx:/mydata/solr/solr-6.9.0/server/solr/batch/data/

迁移完数据后,要重启solr服务才生效。

`@ConfigurationProperties` 是 Spring Boot 提供的一个注解,用于将配置文件(如 `application.properties` 或 `application.yml`)中的属性绑定到 Java 类的字段上。当使用 `prefix = "com.zznode.typhoon.reward.service.firstlevel"` 时,它会将配置文件中以 `com.zznode.typhoon.reward.service.firstlevel` 为前缀的属性映射到对应的 Java 类中。 ### 用法 以下是一个示例,展示了如何使用 `@ConfigurationProperties` 注解: ```java import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; @Component @ConfigurationProperties(prefix = "com.zznode.typhoon.reward.service.firstlevel") public class FirstLevelConfig { private String property1; private int property2; // Getters and Setters public String getProperty1() { return property1; } public void setProperty1(String property1) { this.property1 = property1; } public int getProperty2() { return property2; } public void setProperty2(int property2) { this.property2 = property2; } } ``` 在 `application.properties` 或 `application.yml` 中,可以这样配置属性: ```properties com.zznode.typhoon.reward.service.firstlevel.property1=value1 com.zznode.typhoon.reward.service.firstlevel.property2=123 ``` 或者在 `application.yml` 中: ```yaml com: zznode: typhoon: reward: service: firstlevel: property1: value1 property2: 123 ``` ### 作用 - **集中管理配置**:将相关的配置属性集中到一个 Java 类中,方便管理和维护。 - **类型安全**:通过 Java 类的字段类型来确保配置属性的类型正确,避免因配置错误导致的类型转换异常。 - **自动注入**:可以将配置属性自动注入到需要使用的组件中,提高代码的可维护性和可测试性。 ### 使用场景 - **第三方服务配置**:当需要配置第三方服务的连接信息(如 API 密钥、URL 等)时,可以使用 `@ConfigurationProperties` 将这些配置信息绑定到一个 Java 类中。 - **应用程序自定义配置**:对于应用程序的自定义配置,如缓存时间、线程池大小等,也可以使用该注解进行管理。 - **多环境配置**:在不同的环境(如开发、测试、生产)中,可能需要使用不同的配置值。使用 `@ConfigurationProperties` 可以方便地在不同环境中切换配置。 ### 注意事项 - **组件扫描**:使用 `@ConfigurationProperties` 注解的类需要被 Spring 组件扫描到,通常可以通过 `@Component` 注解将其标记为组件。 - **依赖引入**:确保项目中引入了 `spring-boot-configuration-processor` 依赖,这样在编译时会生成元数据文件,方便 IDE 提供自动补全功能。 ```xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> </dependency> ```
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值