CENTOS7 Configuration mariadb

Source: Internet
Author: User
Tags install php

First, installation and configuration:
  1. Download MARIADB:
    yum -y install mariadb-server mariadb
  2. To open the MARIADB service:
    systemctl start mariadb
  3. No password login mariadb:
    mysql
  4. To view the user table:
    select * from mysql.user\G
  5. To add a remote access User:
    grant all on *.* to ‘root‘@‘%‘ identified by ‘123456‘
  6. To set the add user's authorization rights:
    update mysql.user set Grant_priv=‘Y‘ where Host=‘%‘
  7. To remove an anonymous user:
    delete from mysql.user where Host<>‘%‘ or User<>‘root‘
  8. To exit the MARIADB command line:
    quit
  9. Restart MARIADB:
    systemctl restart mariadb
    Second, master-slave replication:
  10. Server list:
    角色                ip地址主服务器         192.168.8.81从服务器         192.168.8.82
  11. Configuration of the primary server (192.168.8.81):
    A. Configuration:
    Vim/etc/my.cnf

    B. Restart:
    systemctl  restart  mariadb
  12. From server Configuration (192.168.8.82):
    A. Configuration:
    Vim/etc/my.cnf

    B. Restart:
    systemctl  restart  mariadb
  13. master server Settings (192.168.8.81):
    A. Go to the command line:

    B. View status:
  14. From server settings (192.168.8.82):
    A. Go to the command line:

    B. Configuration:

    C. Open:

    D. View status:
  15. Test:
    A. Main:

    B. From:
    Three, Coreseek (Sphinx):
  16. Installation dependencies:
    yum  -y  install  make  gcc  gcc-c++  libtool  autoconf  automake  imake  mariadb  mariadb-server  mariadb-devel libxml2-devel expat-devel
  17. Download the package:
    A. Cloning:
    git  clone  https://github.com/dollarphper/soft.git

    B. Enter the directory:

    cd  soft
  18. Unzip:
    tar  -xzf  coreseek-4.1-beta.tar.gz
  19. Install Mmseg:
    A. Enter the directory:
    cd  coreseek-4.1-beta/mmseg-3.2.14/

    B. Installation:

    ./bootstrap./configure --prefix=/usr/local/mmseg3make && make install
  20. Install Coreseek:
    A. Enter the directory:
    cd  ../csft-4.1

    B. Modify the configuration file:
    Vim Configure.ac

    将AM_INIT_AUTOMAKE([-Wall -Werror foreign])修改为AM_INIT_AUTOMAKE([-Wall foreign])

    C. Download the software:

    yum  -y  install  patch

    D. Patching:

    patch  -p1  <  /home/lee/sphinx/sphinxexpr.cpp-csft-4.1-beta.patch输入:/home/lee/sphinx/coreseek-4.1-beta/csft-4.1/src/sphinxexpr.cpp


    E. Installation:

    sh  buildconf.sh./configure  --prefix=/usr/local/coreseek  --without-unixodbc  --with-mmseg  --with-mmseg-includes=/usr/local/mmseg3/include/mmseg/  --with-mmseg-libs=/usr/local/mmseg3/lib/  --with-mysqlmake  &&  make install
  21. Test:
    A. Enter the test catalog:
    cd  ../testpack/

    B. View the test file:

    cat  var/test/test.xml


    C. Test Chinese participle:

    /usr/local/mmseg3/bin/mmseg  -d  /usr/local/mmseg3/etc var/test/test.xml


    D. Create an index:

    /usr/local/coreseek/bin/indexer  -c  etc/csft.conf  --all


    E. Search test:

    /usr/local/coreseek/bin/search  -c  etc/csft.conf  李彦宏

  22. PHP Connection Sphinx:
    A. Installation extension:
    A-1. Enter directory:
    cd  ../csft-4.1/api/libsphinxclient/

    A-2. Compile:

    aclocallibtoolize --forceautomake --add-missingautoconfautoheadermake clean./configure  --prefix=/usr/local/sphinxclientmake  &&  make install

    A-3. Back to the package directory:

    cd  ../../../../

    A-4. Extract:

    tar  -xzf  sphinx-1.3.0.tgz

    A-5. Install Php-devel:

    yum  -y  install  php  php-devel

    A-6. Enter directory:

    cd  sphinx-1.3.0

    A-7. Installation:

    phpize./configure --with-php-config=/usr/bin/php-config --with-sphinx=/usr/local/sphinxclientmake && make install

    A-8. To open the Php-sphinx extension:
    Vim/etc/php.ini

    在末尾加上:[sphinx]extension=sphinx.so

    B. Testing:
    B-1. To start the MARIADB service:

    systemctl  start  mariadb

    B-2. To add test data:

    mysql  -uroot  -p123456  <  /usr/local/coreseek/etc/example.sql

    B-3. To copy a configuration file:

    cp  /usr/local/coreseek/etc/sphinx.conf.dist  /usr/local/coreseek/etc/csft.confcp  /home/lee/sphinx/coreseek-4.1-beta/mmseg-3.2.14/data/*  /usr/local/mmseg3/etc/

    B-4. To modify a configuration file:
    Vim/usr/local/coreseek/etc/csft.conf

    SOURCE Src1{type = Mysqlsql_host = Localhostsql_user = Rootsql_pass = 123456sql_db = Testsql_port = 3306 # optional, default is 3306sql_query_pre = SET NAMES Utf8sql_sock =/var/lib/mysql/mysql.s Ocksql_query = SELECT ID, group_id, Unix_timestamp (date_added) as date_added, title, content from DOCUMENTSS Ql_attr_uint = Group_idsql_attr_timestamp = Date_addedsql_ranged_throttle = 0sql_query_info_pre = SET NAMES utf8sql _query_info = SELECT * from documents WHERE id= $id}source src1throttled:src1{sql_ranged_throttle = 100}index test1{ Source = Src1path =/usr/local/coreseek/var/data/test1docinfo = Externmlock = 0morph ology = Nonemin_word_len = 1html_strip = 0charset_dictpath =/usr/local/mmseg3/etc/charset_type = Zh_cn.utf-8}indexer{mem_limit = 128m}searchd{listen = 9312listen = 9306:mysql41log =/usr/ local/coreseek/var/log/sEarchd.logquery_log =/usr/local/coreseek/var/log/query.logread_timeout = 5client_timeout = 300max_child ren = 30pid_file =/usr/local/coreseek/var/log/searchd.pidmax_matches = 1000seamless_rotate = 1preop en_indexes = 1unlink_old = 1mva_updates_pool = 1mmax_packet_size = 8mmax_filters = 256max_filter_value s = 4096max_batch_queries = 32workers = threads # for RT-to-work}

    B-5. : Copy the binary file:

    cp  /usr/local/coreseek/bin/*  /usr/bin/

    B-6. Build index:

    indexer  --rotate  --all

    B-7. Start the service:

    searchd

    B-8. Stop service:

    searchd  --stop

    B-9. Test:
    B-9-1. To write a test script:
    Vim test.php

    <?php$sphinx = new SphinxClient();$sphinx->SetServer("127.0.0.1",9312);$sphinx->SetMatchMode(SPH_MATCH_ALL);$sphinx->SetLimits(0, 20, 1000);$sphinx->SetArrayResult(true);$result = $sphinx -> query("one","test1");var_dump($result);

    B-9-2. To run the script:
    PHP test.php

    Four

CENTOS7 Configuration mariadb

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.