Home Database Mysql Tutorial 【实战】sphinx索引合并的脚本

【实战】sphinx索引合并的脚本

Jun 07, 2016 pm 04:10 PM
l mkdir sphinx usr merge Actual combat index Script

mkdir /usr/local/sphinx/scripts----0.全部主索引新建#!/bin/bash#ocpyang@126.com#main_index_update.sh/usr/local/sphinx/bin/indexer src2 -c /usr/local/sphinx/etc/sphinx.conf --rotate /dev/null 21/usr/local/sphinx/bin/indexer src3 -c /usr/loca

mkdir /usr/local/sphinx/scripts


----0.全部主索引新建

#!/bin/bash
#ocpyang@126.com
#main_index_update.sh
/usr/local/sphinx/bin/indexer src2  -c /usr/local/sphinx/etc/sphinx.conf  --rotate > /dev/null 2>&1
/usr/local/sphinx/bin/indexer src3  -c /usr/local/sphinx/etc/sphinx.conf  --rotate > /dev/null 2>&1
/usr/local/sphinx/bin/indexer src4  -c /usr/local/sphinx/etc/sphinx.conf  --rotate > /dev/null 2>&1
/usr/local/sphinx/bin/indexer src5  -c /usr/local/sphinx/etc/sphinx.conf  --rotate > /dev/null 2>&1



----1.增量索引
#!/bin/bash
#ocpyang@126.com
#delta_index_update.sh
/usr/local/sphinx/bin/indexer src2_delta  -c /usr/local/sphinx/etc/sphinx.conf  --rotate > /dev/null 2>&1
/usr/local/sphinx/bin/indexer src3_delta  -c /usr/local/sphinx/etc/sphinx.conf  --rotate > /dev/null 2>&1
/usr/local/sphinx/bin/indexer src4_delta  -c /usr/local/sphinx/etc/sphinx.conf  --rotate > /dev/null 2>&1
/usr/local/sphinx/bin/indexer src5_delta  -c /usr/local/sphinx/etc/sphinx.conf  --rotate > /dev/null 2>&1


---2.合并索引

#!/bin/bash
#ocpyang@126.com
#merge_daily_index.sh
# merge "main + delta" indexes

##1. index abount tblpnr
/usr/local/sphinx/bin/indexer --merge src2 src2_delta -c /usr/local/sphinx/etc/sphinx.conf --rotate >> /usr/local/sphinx/var/log/index_merge.log 2>&1

if [ "$?" -eq 0 ]; then
			/usr/local/mysql/bin/mysql -h127.0.0.1 -uroot -ppassword  -e "REPLACE INTO jinri.sph_counter SELECT 2, MAX(id),max(update_time) FROM jinripnr.tblpnr"
fi


##2. index abount tblticketno
/usr/local/sphinx/bin/indexer --merge src3 src3_delta -c /usr/local/sphinx/etc/sphinx.conf --rotate >> /usr/local/sphinx/var/log/index_merge.log 2>&1

if [ "$?" -eq 0 ]; then
        /usr/local/mysql/bin/mysql -h127.0.0.1 -uroot -ppassword -e "REPLACE INTO jinri.sph_counter SELECT 3, MAX(id),max(update_time) FROM jinritickno.tblticketno"
fi


##3. index abount tblpassengername
/usr/local/sphinx/bin/indexer --merge src4 src4_delta -c /usr/local/sphinx/etc/sphinx.conf --rotate >> /usr/local/sphinx/var/log/index_merge.log 2>&1

if [ "$?" -eq 0 ]; then
        /usr/local/mysql/bin/mysql -h127.0.0.1 -uroot -ppassword -e "REPLACE INTO jinri.sph_counter SELECT 4, MAX(id),max(update_time) FROM jinripname.tblpassengername"
fi



##4. index abount tblorderno
/usr/local/sphinx/bin/indexer --merge src5 src5_delta -c /usr/local/sphinx/etc/sphinx.conf --rotate  >> /usr/local/sphinx/var/log/index_merge.log 2>&1

if [ "$?" -eq 0 ]; then
        /usr/local/mysql/bin/mysql -h127.0.0.1 -uroot -ppassword -e "REPLACE INTO jinri.sph_counter SELECT 5, MAX(id),max(update_time) FROM jinriorderno.tblorderno"
fi

####再次新建增量索引
#delta_index_update.sh
/usr/local/sphinx/bin/indexer src2_delta  -c /usr/local/sphinx/etc/sphinx.conf  --rotate > /dev/null 2>&1
/usr/local/sphinx/bin/indexer src3_delta  -c /usr/local/sphinx/etc/sphinx.conf  --rotate > /dev/null 2>&1
/usr/local/sphinx/bin/indexer src4_delta  -c /usr/local/sphinx/etc/sphinx.conf  --rotate > /dev/null 2>&1
/usr/local/sphinx/bin/indexer src5_delta  -c /usr/local/sphinx/etc/sphinx.conf  --rotate > /dev/null 2>&1



 


# crontab -l

# crontab -e

*/5 * * * *  /usr/local/mysql/scripts/delta_index_update.sh
0 2 * * *    /usr/local/mysql/scripts/merge_daily_index.sh


---合并语法
/usr/local/sphinx/bin/indexer --merge src3 src3_delta -c /usr/local/sphinx/etc/sphinx.conf \
--rotate --merge-dst-range deleted 0 0  --merge-killlists


--查看job执行日志
tail -f /var/log/cron
Copy after login

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to execute .sh file in Linux system? How to execute .sh file in Linux system? Mar 14, 2024 pm 06:42 PM

How to execute .sh file in Linux system? In Linux systems, a .sh file is a file called a Shell script, which is used to execute a series of commands. Executing .sh files is a very common operation. This article will introduce how to execute .sh files in Linux systems and provide specific code examples. Method 1: Use an absolute path to execute a .sh file. To execute a .sh file in a Linux system, you can use an absolute path to specify the location of the file. The following are the specific steps: Open the terminal

How to create a script for editing? Tutorial on how to create a script through editing How to create a script for editing? Tutorial on how to create a script through editing Mar 13, 2024 pm 12:46 PM

Cutting is a video editing tool with comprehensive editing functions, support for variable speed, various filters and beauty effects, and rich music library resources. In this software, you can edit videos directly or create editing scripts, but how to do it? In this tutorial, the editor will introduce the method of editing and making scripts. Production method: 1. Click to open the editing software on your computer, then find the "Creation Script" option and click to open. 2. In the creation script page, enter the "script title", and then enter a brief introduction to the shooting content in the outline. 3. How can I see the "Storyboard Description" option in the outline?

How to use HTML, CSS and jQuery to implement advanced functions of image merging and display How to use HTML, CSS and jQuery to implement advanced functions of image merging and display Oct 27, 2023 pm 04:36 PM

Overview of advanced functions of how to use HTML, CSS and jQuery to implement image merge display: In web design, image display is an important link, and image merge display is one of the common techniques to improve page loading speed and enhance user experience. This article will introduce how to use HTML, CSS and jQuery to implement advanced functions of image merging and display, and provide specific code examples. 1. HTML layout: First, we need to create a container in HTML to display the merged images. You can use di

What are the Oracle index types? What are the Oracle index types? Nov 16, 2023 am 09:59 AM

Oracle index types include: 1. B-Tree index; 2. Bitmap index; 3. Function index; 4. Hash index; 5. Reverse key index; 6. Local index; 7. Global index; 8. Domain index ; 9. Bitmap connection index; 10. Composite index. Detailed introduction: 1. B-Tree index is a self-balancing tree data structure that can efficiently support concurrent operations. In Oracle database, B-Tree index is the most commonly used index type; 2. Bit Graph index is an index type based on bitmap algorithm and so on.

Windows PowerShell Scripting Tutorial for Beginners Windows PowerShell Scripting Tutorial for Beginners Mar 13, 2024 pm 10:55 PM

We've designed this Windows PowerShell scripting tutorial for beginners, whether you're a tech enthusiast or a professional looking to improve your scripting skills. If you have no prior knowledge of PowerShell scripting, this article will start with the basics and be tailored for you. We'll help you master the installation steps for a PowerShell environment and walk you through the main concepts and features of PowerShell scripts. If you're ready to learn more about PowerShell scripting, let's embark on this exciting learning journey together! What is WindowsPowerShell? PowerShell is a hybrid command system developed by Microsoft

PHP Practical: Code Example to Quickly Implement Fibonacci Sequence PHP Practical: Code Example to Quickly Implement Fibonacci Sequence Mar 20, 2024 pm 02:24 PM

PHP Practice: Code Example to Quickly Implement the Fibonacci Sequence The Fibonacci Sequence is a very interesting and common sequence in mathematics. It is defined as follows: the first and second numbers are 0 and 1, and from the third Starting with numbers, each number is the sum of the previous two numbers. The first few numbers in the Fibonacci sequence are 0,1,1.2,3,5,8,13,21,...and so on. In PHP, we can generate the Fibonacci sequence through recursion and iteration. Below we will show these two

Detailed explanation of Word document operation: merge two pages into one Detailed explanation of Word document operation: merge two pages into one Mar 26, 2024 am 08:18 AM

Word documents are one of the most frequently used applications in our daily work and study. When working with documents, you may sometimes encounter a situation where you need to merge two pages into one. This article will introduce in detail how to merge two pages into one page in a Word document to help readers handle document layout more efficiently. In Word documents, the operation of merging two pages into one is usually used to save paper and printing costs, or to make the document more compact and neat. The following are the specific steps to merge two pages into one: Step 1: Open the Word that needs to be operated

Golang Practical Combat: Sharing of Implementation Tips for Data Export Function Golang Practical Combat: Sharing of Implementation Tips for Data Export Function Feb 29, 2024 am 09:00 AM

The data export function is a very common requirement in actual development, especially in scenarios such as back-end management systems or data report export. This article will take the Golang language as an example to share the implementation skills of the data export function and give specific code examples. 1. Environment preparation Before starting, make sure you have installed the Golang environment and are familiar with the basic syntax and operations of Golang. In addition, in order to implement the data export function, you may need to use a third-party library, such as github.com/360EntSec

See all articles