Linux Admin

Install and configure Sphinx search engine for WordPress on CentOS RedHat

No GoodNeed ImprovementOKGoodExcellent (No Ratings Yet)
Loading ... Loading ...

1, Download Sphinx search engine from Sphinx

wget http://www.sphinxsearch.com/downloads/sphinx-0.9.8.tar.gz

tar xzvf sphinx-0.9.7.tar.gz

2, Install MySQL mysql-devel

yum install mysql-devel

3, Configure Sphinx

cd sphinx-0.9.8
./configure –prefix /home/sphinx/sphinxsearch –with-mysql
make
make install

4, Create a configuration file

cd /home/sphinx/sphinxsearch/etc
cp sphinx.conf.dist sphinx.conf

5, Edit sphix.conf

vi sphinx.conf

Configuration file sphinx.conf for wordpress

source mywhiteboard
{
type = mysql
sql_host = localhost
sql_user = mywhiteboard
sql_pass = a1b2c3z4y5×6
sql_db = ivdb
sql_port = 3306
sql_query = SELECT id, post_title, post_content FROM wp_posts
sql_query_info = SELECT * FROM wp_posts WHERE id =$id
}

index mywhiteboard
{
source = mywhiteboard
path = /home/sphinx/sphinxsearch/var/data/mywhiteboard
docinfo = extern
mlock = 0
morphology = stem_en

enable_star=1

stopwords = /home/sphinx/sphinxsearch/var/data/stopwords.txt
min_word_len = 3
charset_type = sbcs
min_prefix_len = 0
min_infix_len = 3
html_strip = 1
html_remove_elements = style, script
}

indexer
{
mem_limit = 256M
}
searchd
{
port = 3312
log = /home/sphinx/sphinxsearch/var/log/searchd.log
query_log = /home/sphinx/sphinxsearch/var/log/query.log
read_timeout = 5
max_children = 30
pid_file = /home/sphinx/sphinxsearch/var/log/searchd.pid
max_matches = 1000
seamless_rotate = 1
preopen_indexes = 0
unlink_old = 1
}

6, make a directory for indexes

mkdir
/home/sphinx/sphinxsearch/var/data/mywhiteboard

7,  Start indexer:

/home/sphinx/sphinxsearch/bin/indexer
--config  /home/sphinx/sphinxsearch/etc/sphinx.conf --all

Sphinx 0.9.8-release (r1371)
Copyright (c) 2001-2008, Andrew Aksyonoff

using config file ‘/home/sphinx/sphinxsearch/etc/sphinx.conf’…
indexing index ‘mywhiteboard’…
collected 1104407 docs, 1938.9 MB
sorted 6551.8 Mhits, 98.5% donedone
total 1104407 docs, 1938867135 bytes
total 5126.826 sec, 378180.78 bytes/sec, 215.42 docs/sec

8, To test if it is working:

/home/sphinx/sphinxsearch/bin/search
--config /home/sphinx/sphinxsearch/etc/sphinx.conf insulin

….
20. document=9345, weight=3
    id=9345
….
words:
1. ‘insulin’: 30601 documents, 109926 hits

9, See how much disk space the indexer used:

ls -la
/home/sphinx/sphinxsearch/var/data/mywhiteboard
drwxr-xr-x 3 root root 4096 Oct 21 16:20 .
drwxr-xr-x 4 root root 4096 Sep 11 20:08 ..
-rw-r–r– 1 root root 0 Oct 21 15:32 mywhiteboard.spa
-rw-r–r– 1 root root 14925566596 Oct 21 16:20 mywhiteboard.spd
-rw-r–r– 1 root root 237 Oct 21 16:20 mywhiteboard.sph
-rw-r–r– 1 root root 57254921 Oct 21 16:20 mywhiteboard.spi
-rw-r–r– 1 root root 0 Oct 21 15:32 mywhiteboard.spm
-rw-r–r– 1 root root 22721504506 Oct 21 16:20 mywhiteboard.spp

Popularity: 2%

Comments

How to Set Idle Timeout in Linux SSH (Redhat, CentOS)

No GoodNeed ImprovementOKGoodExcellent (2 votes, average: 5 out of 5)
Loading ... Loading ...

1, Edit sshd_config

vi /etc/ssh/sshd_config

2, Edit ClientAliveInterval and ClientAliveCountMax

ClientAliveInterval 600
ClientAliveCountMax 3

this will give you 30 minute idle time (3 x 600 seconds) and you don’t need to reconnect your application (SCP, Putty) every few minutes.

3, Restart sshd:

/etc/init.d/sshd restart

Technorati :
Del.icio.us :

Popularity: 4%

Comments

How to install ehour timesheet on Linux

No GoodNeed ImprovementOKGoodExcellent (No Ratings Yet)
Loading ... Loading ...

1, Download ehou war file (ehour-0.8.2-war.zip) from http://www.ehour.nl/download.phtml, unzip it.

2, Download and install Tomcat.

3, Download and install MySQL, download JDBC driver for MySQL, unzip and put driver jar file into $Tomcat_home/lib.

4, Put ehour-0.8.2-war to $Tomcat_home/webapps

5, Copy context.xml to context.xml.orig, and edit context.xml

<Context path="/ehour" reloadable="false" cookies="true" docBase="${catalina.home}/webapps/ehour-0.8.2">
<Resource name=”jdbc/eHourDS”
auth=”Container”
type=”javax.sql.DataSource”
maxActive=”100″
maxIdle=”30″
maxWait=”10000″
username=”ehour”
password=”changeme”
driverClassName=”com.mysql.jdbc.Driver”
url=”jdbc:mysql://localhost:3306/ehour?zeroDateTimeBehavior=convertToNull”/>
<ResourceParams name=”jdbc/eHourDS” >
<parameter>
<name>validationQuery</name>
<value>SELECT 1</value>
</parameter>
<parameter>
<name>testOnBorrow</name>
<value>true</value>
</parameter>

<parameter>
<name>zeroDateTimeBehavior</name>
<value>convertToNull</value>
</parameter>
<parameter>
<name>autoReconnect</name>
<value>true</value>
</parameter>
<parameter>
<name>timeBetweenEvictionRunsMillis</name>
<value>10000</value>
</parameter>
<parameter>
<name>testWhileIdle</name>
<value>true</value>
</parameter>
<parameter>
<name>minEvictableIdleTimeMillis</name>
<value>60000</value>
</parameter>
</ResourceParams>
</Context>

edit server.xml

<Host name="timecard.ebiocenter.com" appBase="webapps"
unpackWARs=”true” autoDeploy=”true”
xmlValidation=”false” xmlNamespaceAware=”false”>

<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html –>
<!–
<Valve className=”org.apache.catalina.authenticator.SingleSignOn” />
–>
<!– Access log processes all example.
Documentation at: /docs/config/valve.html –>
<!–
<Valve className=”org.apache.catalina.valves.AccessLogValve” directory=”logs”
prefix=”localhost_access_log.” suffix=”.txt” pattern=”common” resolveHosts=”false”/>
–>
</Host>

6, start Tomcat

Technorati :
Del.icio.us :

Popularity: 4%

Comments

« Previous Next »