1
0
mirror of https://github.com/chatopera/cosin.git synced 2025-08-01 16:38:02 +08:00

#51 使用elasticsearch服务

This commit is contained in:
Hai Liang Wang 2018-09-05 17:23:21 +08:00
parent b2d163063f
commit 917491f5ce
15 changed files with 36 additions and 15 deletions

View File

@ -29,7 +29,7 @@ import org.springframework.data.elasticsearch.annotations.Document;
import com.chatopera.cc.util.UKTools; import com.chatopera.cc.util.UKTools;
@Document(indexName = "uckefu", type = "uk_contacts") @Document(indexName = "cskefu", type = "contacts")
@Entity @Entity
@Table(name = "uk_contacts") @Table(name = "uk_contacts")
@org.hibernate.annotations.Proxy(lazy = false) @org.hibernate.annotations.Proxy(lazy = false)

View File

@ -30,7 +30,7 @@ import org.springframework.data.elasticsearch.annotations.Document;
import com.chatopera.cc.util.UKTools; import com.chatopera.cc.util.UKTools;
@Document(indexName = "uckefu", type = "uk_entcustomer") @Document(indexName = "cskefu", type = "entcustomer")
@Entity @Entity
@Table(name = "uk_entcustomer") @Table(name = "uk_entcustomer")
@org.hibernate.annotations.Proxy(lazy = false) @org.hibernate.annotations.Proxy(lazy = false)

View File

@ -34,7 +34,7 @@ import org.springframework.data.elasticsearch.annotations.Parent;
import com.chatopera.cc.util.UKTools; import com.chatopera.cc.util.UKTools;
@Document(indexName = "uckefu", type = "uk_favorites" , createIndex = false ) @Document(indexName = "cskefu", type = "favorites" , createIndex = false )
@Entity @Entity
@Table(name = "uk_favorites") @Table(name = "uk_favorites")
@org.hibernate.annotations.Proxy(lazy = false) @org.hibernate.annotations.Proxy(lazy = false)

View File

@ -35,7 +35,7 @@ import com.chatopera.cc.util.UKTools;
/** /**
* *
*/ */
@Document(indexName = "uckefu", type = "uk_kbs_topic") @Document(indexName = "cskefu", type = "kbs_topic")
@Entity @Entity
@Table(name = "uk_kbs_topic") @Table(name = "uk_kbs_topic")
@org.hibernate.annotations.Proxy(lazy = false) @org.hibernate.annotations.Proxy(lazy = false)

View File

@ -32,7 +32,7 @@ import org.springframework.data.elasticsearch.annotations.FieldIndex;
import org.springframework.data.elasticsearch.annotations.FieldType; import org.springframework.data.elasticsearch.annotations.FieldType;
import com.chatopera.cc.util.UKTools; import com.chatopera.cc.util.UKTools;
@Document(indexName = "uckefu", type = "uc_kbs_topiccomment") @Document(indexName = "cskefu", type = "kbs_topiccomment")
public class KbsTopicComment implements UKAgg{ public class KbsTopicComment implements UKAgg{
/** /**

View File

@ -33,7 +33,7 @@ import org.springframework.data.elasticsearch.annotations.FieldIndex;
import org.springframework.data.elasticsearch.annotations.FieldType; import org.springframework.data.elasticsearch.annotations.FieldType;
import com.chatopera.cc.util.UKTools; import com.chatopera.cc.util.UKTools;
@Document(indexName = "uckefu", type = "uk_orderscomment") @Document(indexName = "cskefu", type = "orderscomment")
@Entity @Entity
@Table(name = "uk_orderscomment") @Table(name = "uk_orderscomment")
@org.hibernate.annotations.Proxy(lazy = false) @org.hibernate.annotations.Proxy(lazy = false)

View File

@ -31,7 +31,7 @@ import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Document;
import com.chatopera.cc.util.UKTools; import com.chatopera.cc.util.UKTools;
@Document(indexName = "uckefu", type = "uk_publishedreport") @Document(indexName = "cskefu", type = "publishedreport")
@Entity @Entity
@Table(name = "uk_publishedreport") @Table(name = "uk_publishedreport")
@org.hibernate.annotations.Proxy(lazy = false) @org.hibernate.annotations.Proxy(lazy = false)

View File

@ -29,7 +29,7 @@ import org.springframework.data.elasticsearch.annotations.Document;
import com.chatopera.cc.util.UKTools; import com.chatopera.cc.util.UKTools;
@Document(indexName = "uckefu", type = "uk_quickreply") @Document(indexName = "cskefu", type = "quickreply")
@Entity @Entity
@Table(name = "uk_quickreply") @Table(name = "uk_quickreply")
@org.hibernate.annotations.Proxy(lazy = false) @org.hibernate.annotations.Proxy(lazy = false)

View File

@ -31,7 +31,7 @@ import com.chatopera.cc.util.UKTools;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Document;
@Document(indexName = "uckefu", type = "uk_report") @Document(indexName = "cskefu", type = "report")
@Entity @Entity
@Table(name = "uk_report") @Table(name = "uk_report")
@org.hibernate.annotations.Proxy(lazy = false) @org.hibernate.annotations.Proxy(lazy = false)
@ -275,4 +275,4 @@ public class Report extends ESBean implements java.io.Serializable{
this.reportFilters = reportFilters; this.reportFilters = reportFilters;
} }
} }

View File

@ -36,7 +36,7 @@ import com.chatopera.cc.util.UKTools;
/** /**
* uk_xiaoe_topic * uk_xiaoe_topic
*/ */
@Document(indexName = "uckefu", type = "uk_xiaoe_topic") @Document(indexName = "cskefu", type = "xiaoe_topic")
@Entity @Entity
@Table(name = "uk_xiaoe_topic") @Table(name = "uk_xiaoe_topic")
@org.hibernate.annotations.Proxy(lazy = false) @org.hibernate.annotations.Proxy(lazy = false)

View File

@ -34,7 +34,7 @@ import com.chatopera.cc.util.UKTools;
/** /**
* *
*/ */
@Document(indexName = "uckefu", type = "uk_workorders" , createIndex = false ) @Document(indexName = "cskefu", type = "workorders" , createIndex = false )
@Entity @Entity
@Table(name = "uk_workorders") @Table(name = "uk_workorders")
@org.hibernate.annotations.Proxy(lazy = false) @org.hibernate.annotations.Proxy(lazy = false)

View File

@ -72,7 +72,7 @@ spring.data.jpa.repositories.enabled=true
# Elasticsearch # Elasticsearch
spring.data.elasticsearch.properties.path.data=../data spring.data.elasticsearch.properties.path.data=../data
#spring.data.elasticsearch.cluster-name=ukefu #spring.data.elasticsearch.cluster-name=elasticsearch
#spring.data.elasticsearch.cluster-nodes=127.0.0.1:9300 #spring.data.elasticsearch.cluster-nodes=127.0.0.1:9300
#spring.data.elasticsearch.local=false #spring.data.elasticsearch.local=false
#spring.data.elasticsearch.repositories.enabled=true #spring.data.elasticsearch.repositories.enabled=true

View File

@ -64,6 +64,10 @@ services:
- SPRING_REDIS_HOST=redis - SPRING_REDIS_HOST=redis
- SPRING_REDIS_PORT=6379 - SPRING_REDIS_PORT=6379
- CSKEFU_CALLOUT_WATCH_INTERVAL=60000 - CSKEFU_CALLOUT_WATCH_INTERVAL=60000
- SPRING_DATA_ELASTICSEARCH_CLUSTER_NAME=elasticsearch
- SPRING_DATA_ELASTICSEARCH_CLUSTER_NODES=elasticsearch:9300
- SPRING_DATA_ELASTICSEARCH_LOCAL=false
- SPRING_DATA_ELASTICSEARCH_REPOSITORIES_ENABLED=true
depends_on: depends_on:
- mysql - mysql
- redis - redis

View File

@ -5,8 +5,11 @@ http.cors.enabled: true
http.cors.allow-origin: "*" http.cors.allow-origin: "*"
# Uncomment the following lines for a production cluster deployment # Uncomment the following lines for a production cluster deployment
# #transport.host: 0.0.0.0 transport.host: 0.0.0.0
# #discovery.zen.minimum_master_nodes: 1 discovery.zen.minimum_master_nodes: 1
cluster.routing.allocation.disk.threshold_enabled: true cluster.routing.allocation.disk.threshold_enabled: true
cluster.routing.allocation.disk.watermark.low: 1gb cluster.routing.allocation.disk.watermark.low: 1gb
cluster.routing.allocation.disk.watermark.high: 1gb cluster.routing.allocation.disk.watermark.high: 1gb
node.master: true
node.data: true

14
scripts/start.sh Executable file
View File

@ -0,0 +1,14 @@
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
cd $baseDir/..
docker-compose pull elasticsearch mysql redis contact-center
docker-compose up -d