anonymous user

Forums   Register   Login   Forgot your login/password?   Search

Tutorial: Installing on Windows

Common forum | 1 | 2 | 3 | 4 | 5 | ... | 519 | 520 | 521 | 522 | next »» | Create new thread

Das123

Name: Darren
Posts: 25

2009-02-06 07:08:29 | reply!


Well, I think I've come across just about every unusual nuance and hurdle in getting
Sphinx to work on a Windows system as is possible. :) The responses in this forum have
been a great help with people who have had similar problems - so thank you for posting.

Anyhow, I thought I would share the problems and solutions I have had so far in a hope it
helps other 'Sphinx newbies' like me. I'm going to keep this REALLY comprehensive and
hopefully I won't leave anything out. I will however be glossing over the MySQL side of
things and assuming you have this under control. Lets also make the assumption that the
sample data provided in 'example.sql' is the basis for what we are building.


PREPARATION:
1. Make sure you download the 'Windows Binaries' version rather than the source version.


UNZIPPING THE CONTENTS:
2. Unzip the contents onto your hard-drive. You may also want to change the directory
name to just 'Sphinx' rather than keeping the version details as well. For the sake of
this exercise, we'll assume the location is 'C:\Sphinx\' to keep it simple.

By the way, you can completely ignore the Installation Help for Windows in the 'docs'
directory. And you also won't be needing the C++ Compiler! The installation documentation
was written for installing from the source - not with the binaries already compiled as
per the version we have downloaded. That little tid-bit alone would have saved me a
couple of hours. :)


CONSTRUCTING THE CONFIG FILE:
Everything to do with the installation of Sphinx seems to come down to how you have built
your config file. It is important to get this right.

For the sake of this exercise, I'm going to assume that I want my Sphinx configuration
and data files kept with a specific project rather than just sitting in with the Sphinx
executables. This will allow me to back-up the configs etc with the project and should
keep things a bit neater. For the sake of this exercise lets assume the location for
these will be in 'C:\Internet\Project\sphinx\'.

3. Copy the 'sphinx-min.conf.in' file from the zip file root directory and paste it into
the new location. Lets also change the name to 'project.conf'. Also open up the
'sphinx.conf.in' file in your favourite text editor as this gives good reference of other
sorts of commands you may want to use and explains what the commands in the 'min' file
are for.

4. Open up the new 'project.conf' file and fill in the following:
- You can change the name of the 'source' if you like. Just make sure you also change the
reference in the 'index'.
- Fill in the relevant SQL commands for the source, particularly making sure your
database connections are accurate.
- Change the index name as well if you wish.
- *IMPORTANT* Make sure you find all path references, eg: '@CONFDIR@/data/test1' and
convert them to full references with Windows directory slashes (\). So for this example,
it would read 'C:\Internet\Project\sphinx\data\test1'.
- *IMPORTANT* Make sure 'seamless_rotate = 0' in the 'searchd' section. This will
stop the search service from running if it is left set at '1'! (Only took me 90 minutes
to discover that little gem.)


PLACE THE LIBMYSQL.DLL FILE WHERE WINDOWS CAN FIND IT
5. Copy (not move) the 'libmySQL.dll' file from your MySQL install
(C:\wamp\bin\mysql\mysql5.0.51b\bin\libmySQL.dll on my system) and copy into your Windows
System32 folder (C:\Windows\System32\). There is probably a cleaner way to handle this,
but Sphinx looks for this when doing the setup of the data. There is most likely a
cleaner way to handle this with paths etc - but this method worked for me. :)


DATA & LOG DIRECTORIES
6. The installation process can get bogged down if the installer can't find existing
directories for the data or log files. The safest bet is to physically make the 'data'
and 'log' files inside your configuration directory. In this example,
'C:\Internet\Project\sphinx\data\' and 'C:\Internet\Project\sphinx\log\'.


MAKING AN INSTALLATION BATCH FILE
I got tired of writing out the commands in the command prompt window so ended up just
writing a batch file to handle the installation. This also gives you a record of the
commands if you need to move everything to another system.

7. Write the following (to suit your parameters) in a text editor and save it as
'sphinx_install.bat'. I saved mine in with the project.

-------------------------START FILE-------------------------

    C:\sphinx\bin\indexer.exe --config C:\Internet\Project\sphinx\project.conf test1

    pause

    C:\sphinx\bin\searchd.exe --install --config C:\Internet\Project\sphinx\project.conf
    --servicename ProjectSearch

    pause

--------------------------END FILE---------------------------

8. Double click the batch file. A Command window will open and initially run the indexer
and then pause, waiting for you to press any key. Read what it says carefully. It should
tell you what it did and also highlight any errors along the way which will help with
debugging.

9. After pressing any key, the batch file should then run the 'searchd.exe' file and
create the search daemon (love that word ;) ). Read the printing in the command window to
make sure it did what it needed to do. You may get warnings about skipping sections -
don't worry, it's supposed to do that. :)

STARTING THE SERVICE
10. Open the 'Services' window from 'Control Panel -> Administrative Tools'. Now, we used
the '--servicename' switch so we should have a service called 'ProjectSearch'. Click on
it and then click 'Start Service'.

If you get no errors, well done, the job is done and you can treat yourself to nice cool
drink, patting yourself on the back as you do so. :)

DEBUGGING TIPS
If the service doesn't start, run the service as a console by typing the following in a
command prompt (changing the directories to suit your settings)...

C:\sphinx\bin\searchd.exe --console --config C:\Internet\Project\sphinx\project.conf


Hope this helps other Windows installers out there. :)

Arantor

Name: Pete Spicer
Posts: 4444

to: Das123, 2009-02-06 11:22:47 | reply!


First of all, thank you for writing this guide! I'm sure it will be appreciated.

(I should add, there is a proper Windows installer in the works.)

I do have a few comments though.

> - *IMPORTANT* Make sure 'seamless_rotate = 0' in the 'searchd' section. This will
> stop the search service from running if it is left set at '1'! (Only took me 90 minutes
> to discover that little gem.)

No reason why it should do that. Works fine for me, 0.9.8.1 and 0.9.9 on WinXP.

> PLACE THE LIBMYSQL.DLL FILE WHERE WINDOWS CAN FIND IT
> 5. Copy (not move) the 'libmySQL.dll' file from your MySQL install
> (C:\wamp\bin\mysql\mysql5.0.51b\bin\libmySQL.dll on my system) and copy into your Windows
> System32 folder (C:\Windows\System32\). There is probably a cleaner way to handle this,
> but Sphinx looks for this when doing the setup of the data. There is most likely a
> cleaner way to handle this with paths etc - but this method worked for me. :)

That's something I forgot to pick up in the trouble-shooting thread. A copy of this is
going to be bundled in the installer.

I think you can dump it in the same directory as the executable files for Sphinx.

> DATA & LOG DIRECTORIES
> 6. The installation process can get bogged down if the installer can't find existing
> directories for the data or log files. The safest bet is to physically make the 'data'
> and 'log' files inside your configuration directory. In this example,
> 'C:\Internet\Project\sphinx\data\' and 'C:\Internet\Project\sphinx\log\'.

This will not work. You have to provide full paths to the files, including filenames.

> MAKING AN INSTALLATION BATCH FILE
> I got tired of writing out the commands in the command prompt window so ended up just
> writing a batch file to handle the installation. This also gives you a record of the
> commands if you need to move everything to another system.

This is something that will be helped in the forthcoming installer, but is a good
solution for the interim.

Note that you can run non-seamless rotating; i.e. leave the service to autostart (as
would be default) and simply add --rotate when calling indexer. Again, works perfectly
for me.


> 9. After pressing any key, the batch file should then run the 'searchd.exe' file and
> create the search daemon (love that word ;) ). Read the printing in the command window to
> make sure it did what it needed to do. You may get warnings about skipping sections -
> don't worry, it's supposed to do that. :)

You could always remove the sections in question if you're not using either the inherited
example (test1stemmed IIRC) or the distributed example. None of my setups throw any
errors, for example.

> DEBUGGING TIPS
> If the service doesn't start, run the service as a console by typing the following in a
> command prompt (changing the directories to suit your settings)...

> C:\sphinx\bin\searchd.exe --console --config C:\Internet\Project\sphinx\project.conf

If you run from CMD, you don't need to explicitly hit --console, it should force it
anyway.

Das123

Name: Darren
Posts: 25

to: Arantor, 2009-02-06 21:05:36 | reply!


Thanks for clearing up a few of the issues. The installer will be great. :)

Below are some further comments:

> > - *IMPORTANT* Make sure 'seamless_rotate = 0' in the 'searchd' section. This will
> stop the search service from running if it is left set at '1'! (Only took me 90 minutes
> to discover that little gem.)
>
> No reason why it should do that. Works fine for me, 0.9.8.1 and 0.9.9 on WinXP.

Without this, when I was trying to start the service I was getting an error but it wasn't
telling me the issue. So I ended up running it from the console and an error message
stated that 'rotate' can't be used with windows. As 'seamless_rotate' was the only rotate
command in my config I just unset it and it worked.

> > DATA & LOG DIRECTORIES
> > 6. The installation process can get bogged down if the installer can't find existing
> directories for the data or log files. The safest bet is to physically make the 'data'
> and 'log' files inside your configuration directory. In this example,
> 'C:\Internet\Project\sphinx\data\' and 'C:\Internet\Project\sphinx\log\'.
>
> This will not work. You have to provide full paths to the files, including filenames.

Yes. I was trying to say that. :) The full paths need to be in the config file AND the
'data' and 'log' directories need to physically exist.

Thanks again :)

Arantor

Name: Pete Spicer
Posts: 4444

to: Das123, 2009-02-06 21:36:57 | reply!


> Without this, when I was trying to start the service I was getting an error but it wasn't
> telling me the issue. So I ended up running it from the console and an error message
> stated that 'rotate' can't be used with windows. As 'seamless_rotate' was the only rotate
> command in my config I just unset it and it worked.

All it means is that you can't use --rotate when building indexes unless searchd is
already running.

agabardo

Name: Ademir Gabardo
Posts: 2

to: Das123, 2009-10-01 22:17:32 | reply!


Hi, thank you very much for the help, I have run over the Internet for hours until find
this tutorial.
Now the service was Started at the windows.
But I was not sure what is the next steps.
Can somebody give me a tip?
Best Regards
Ademir Gabardo - Curitiba/Brasil

Arantor

Name: Pete Spicer
Posts: 4444

to: agabardo, 2009-10-02 11:00:28 | reply!


> Hi, thank you very much for the help, I have run over the Internet for hours until find
> this tutorial.
> Now the service was Started at the windows.
> But I was not sure what is the next steps.
> Can somebody give me a tip?

As per the manual, build an index for your data, then start searching.

agabardo

Name: Ademir Gabardo
Posts: 2

to: Arantor, 2009-10-02 13:44:50 | reply!


HI, my doubt is how to set wich querys will be indexed by the Sphinx engine.
I have several Selects, to index.
Each one will be a .conf file?

If is this the case, after indexing the content, how I will search on this data?
I was looking to use PHP with Code Igniter.

Thank's for any help.
This is my first contact with the Sphinx.
Best Regards
Ademir

avergara08

Name: Aaron
Posts: 1

to: Das123, 2011-05-26 07:54:13 | reply!


thank you for this tutorial.

everything went good for me until the .bat file. i keep getting this error:

using config file 'C:\Internet\Project\sphinx\project.conf'...
indexing index 'test1'...
collected 4 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 4 docs, 193 bytes
total 0.034 sec, 5538 bytes/sec, 114.79 docs/sec
total 2 reads, 0.000 sec, 0.1 kb/call avg, 0.0 msec/call avg
total 7 writes, 0.000 sec, 0.1 kb/call avg, 0.0 msec/call avg
Error in my_thread_global_end(): 1 threads didn't exit



it will highly be appreciated if anyone can help. thank you :)

kschindler

Name: Kate
Posts: 1

to: Das123, 2011-10-03 19:24:04 | reply!


This is by far the best tutorial I've seen out there - thank you so much!

I realize that the MediaWiki forums might be a better place for my question, and if so I
apologize. But similar questions in that forum tend to either say "Try the Sphinx forum"
or don't get replies, so here I am. I'm not a programmer, and don't have access to one
for this project. If there's a simpler extension to get my offline Wikipedia search to
work (it times out and rarely loads the full page even when it works), I'm fine with
that, but this is the only one I've read about.

I only got up to step 8 in the instructions. I believe I did everything correctly except
step 5 (I don't have a libmysql.dll file in C:\wamp\bin\mysql\mysql5.5.8\bin), but when I
tried to run the batch file in step 8 I got "ERROR: index 'test1': sql_query: Table
'wikipedia.documents' doesn't exist (DSN=mysql://root:***@localhost:3306/wikipedia)."

Thanks in advance for your help!

Common forum | 1 | 2 | 3 | 4 | 5 | ... | 519 | 520 | 521 | 522 | next »» | Create new thread