配置文件

一. solr配置

1. data-config.xml


    
    
        
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
        

        
            
            
            
            
            
            
            
            
        

    
    

2. schema

    
        
            
             
        
        
            
             
        
    



     
     
     
     
     
     
     
     
     
     
     
     
     
    
    
    

    
    

    

     
     
     
     

二. nginx配置

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    gzip  on;
    gzip_comp_level  5;
    gzip_min_length  1024;
    gzip_types   text/plain application/x-javascript text/css application/xml text/javascript  image/jpeg image/gif image/png;
    server {
        # 默认电脑端访问
        listen       80;
        server_name  ff.com www.ff.com;   #localhost;
        #access_log  logs/host.access.log  main;
        location / {
            root   /usr/local/project/static/pc;
            index  index.html ;
        }
        # 根据header判断是否是手机端用户  如果是手机端端就跳转m站
        if ( $http_user_agent ~* "(Android|iPhone|Windows Phone|UC|Kindle)" ){
            rewrite ^/(.*)$  http://m.ff.com$uri redirect;
        }
    }
    # 手机端访问m站
    server {
        listen       80;
        server_name  m.ff.com;
        location / {
            root   /usr/local/project/static/phone;
            # try_files $uri $uri/ /index.html last;
            index  index.html;
        }
    }
    # 后端接口 二级域名 跳转到 springboot占用的8888端口
    server {
        listen       80;
        server_name  api.ff.com;
        location / {
            proxy_pass   http://localhost:8888;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header Host $http_host;
        }
    }

    # 后台管理系统
    server {
        listen       8800;
        server_name  localhost;
        location / {
            root   /usr/local/project/static/admin;
            try_files $uri $uri/ /index.html last;
            index  index.html;
        }
    }


}

一. elasticsearch配置

从数据库获取父子结构的数据

  1. 配置es
network.host: 0.0.0.0
http.cors.enabled: true
http.cors.allow-origin: "*"
http.port: 9200
transport.tcp.port: 9300
transport.tcp.compress: true
  1. 配置logstash
input {
    jdbc {
      jdbc_connection_string => "jdbc:mysql://45.96.132.27:3306/bat_test?zeroDateTimeBehavior=convertToNull"
      jdbc_user => "root"
      jdbc_password => "ahahaha2"
      jdbc_driver_library => "../config/mysql-connector-java-5.1.41.jar"
      jdbc_driver_class => "com.mysql.jdbc.Driver"
      jdbc_paging_enabled => "true"
      jdbc_page_size => "50000"
      statement_filepath => "../config/getOrder.sql"
      schedule => "*/5 * * * *"
      type => "jdbc_order"
      add_field => { "join_field" => "order"}
      
    }
    jdbc {
      jdbc_connection_string => "jdbc:mysql://45.96.132.27:3306/bat_test?zeroDateTimeBehavior=convertToNull"
      jdbc_user => "root"
      jdbc_password => "ahahaha2"
      jdbc_driver_library => "../config/mysql-connector-java-5.1.41.jar"
      jdbc_driver_class => "com.mysql.jdbc.Driver"
      jdbc_paging_enabled => "true"
      jdbc_page_size => "50000"
      statement_filepath => "../config/getProduct.sql"
      schedule => "*/5 * * * *"
      type => "jdbc_product"
      add_field => {
                "[join_field][name]" => "product"
                "[join_field][parent]" => "%{order_id}"
            }
    }
    
}
output {
 stdout {
        codec => json_lines
    }
    if[type] == "jdbc_order"{
        elasticsearch {
        hosts  => "localhost:9200"
        index => "order_product_index"
        document_type => "order"
        document_id => "%{order_id}"
        }
    }
    if[type] == "jdbc_product"{
        elasticsearch {
        hosts  => "localhost:9200"
        index => "order_product_index"
        document_type => "order"
        document_id => "%{id}"
        routing => "%{order_id}"
        }
    }
}
  1. 创建索引
put  localhost:9200/order_product_index/ 
{
 "mappings": {
   "order": {
     "properties": {
       "join_field": { 
         "type": "join",
         "relations": {
           "order": "product" 
         }
       }
     }
   }
 }
}
  1. 搜索:查询父文档,并显示所有子文档
get localhost:9200/order_product_index/order/_search
{
    "query": {
        "has_child": {
            "type": "product",
            "query": {
                "match_all": {}
            },
            "inner_hits": {}
        }
    }
}
  1. 搜索:根据父文档查询,并显示所有子文档
{
    "query": {
        "bool": {
            "filter": 
             
                {
                    "bool":{
                        "should":[
                            {
                                "regexp": { "creatorname": ".*冯帆海涛.*"}
                            },
                            {
                                "regexp": { "order_id": ".*100000156.*"}
                            }
                        ]
                
                    }
                }
            ,
            "must":[
                {
                    "has_child": {
                        "type": "product",
                        "query": {
                            "match_all": {}
                        },
                        "inner_hits": {"size": 10}
                    }
                }
            ]
        }
        
        
        
    },
    "from" : 0,
    "size" : 10,
    "sort":{"create_time":{"order":"desc"}}
}

你可能感兴趣的:(配置文件)