coreseek4.1分布式

  1. 创建数据源(mysql,mysql2)

    source mysql
    {
        type                    = mysql
        sql_host              = localhost
        sql_user              = root
        sql_pass              = root
        sql_db                 = test
        sql_port                = 3306
        sql_query_pre            = SET NAMES utf8
        sql_query                = SELECT id, group_id, UNIX_TIMESTAMP(date_added) AS date_added, title, content FROM documents
        sql_attr_uint            = group_id
        sql_attr_timestamp        = date_added
        sql_query_info_pre      = SET NAMES utf8
        sql_query_info            = SELECT * FROM documents WHERE id=$id
    }
    source mysql2 : mysql
    {
        sql_db                  = test2
    }

    #保持这两张表的id唯一

  2. 创建索引(mysql,mysql2,dist1),及其他配置

    index mysql
    {
        source                 = mysql
        path                    = E:/coreseek/var/data/mysql
        docinfo               = extern
        mlock                  = 0
        morphology        = none
        min_word_len      = 1
        html_strip            = 0
        charset_dictpath  = E:/coreseek/etc/
        charset_type        = zh_cn.utf-8
    }
    index mysql2 : mysql
    {
        source           = mysql2
        path              = E:/coreseek/var/data/mysql2
    }

    index dist1
    {  
            type                                        = distributed      
            local                                       = mysql
            local                                       = mysql2
            agent_query_timeout              = 100000  
            agent_connect_timeout          = 1000
    }
    #全局index定义
    indexer
    {
        mem_limit            = 128M
    }
    #searchd服务定义
    searchd
    {
        listen                  =   9312
        read_timeout        = 5
        max_children        = 30
        max_matches            = 1000
        seamless_rotate        = 0
        preopen_indexes        = 0
        unlink_old            = 1
        pid_file = e:/coreseek/var/log/searchd_mysql.pid
        log = e:/coreseek/var/log/searchd_mysql.log 
        query_log = e:/coreseek/var/log/query_mysql.log
        binlog_path = #e:/coreseek/var/log/end.log
    }

  3. 启动

    ##建立索引

    indexer -c sphinx.config --all   #我的配置文件就放在E:/coreseek/bin下

    ##启动服务

    searchd -c sphinx.config

    ##更新所有索引

    indexer -c sphinx.conf --all --rotate

  4. 测试

    在http://www.oschina.net/code/snippet_1590790_48728的基础上加一个数据库连接查询

    coreseek4.1分布式


你可能感兴趣的:(coreseek4.1分布式)