I am trying to use Sphinx full-text search capability for my MySQL server.
I have setup a local Sphinx service based on the installation manual and able to do text search.
I can connect to
mysql.exe --host=127.0.0.1 port=9306
Where the port 9306 is the port configured in sphinx.conf:
searchd {
...
listen = 9306:mysql41
...
}
And do SphinxQL queries. I am using the default Sphinx example database shipped with the release package.
However I want to integrate Sphinx with my MySQL server, such that all the clients connecting to my sql server can do SphinxQL and I want to try it out with the MySQL sample database sakila
What are the steps to achieve that?
Do I need to convert the database engine from InnoDB to Sphinx?
Also, from what it seems, Sphinx can only index one (1) database
table per configuration, how can I make sure that all tables in the
MySQL database gets indexed?
However I want to integrate Sphinx with my MySQL server, such that all the clients connecting to my sql server can do SphinxQL
Can't do that. Sphinx (when enabled for sphinxQL) just gives you a server that looks like a mysql one - ie it uses the same communications protocol - mainly so can just reuse mysql client libraries, rather than having to make a new one just for sphinx.
They are different 'servers'. You connect to a mysql server to run mysql commands; you connect to sphinx server to run sphinxQL commands.
The application woudl have to connect to each 'server' seperately. Just imagine sphinx was something like postgres, you clearly dont connect to mysql and expect to be able to run postgresql.
However there is SphinxSE - which is a fake mysql storage engine. You install it into mysql, and you can then create a table using this engine. Then you run mysql queries against this table, under the hood are contacts a running sphinx-server. So to mysql it looks like a table that contains data, this is most useful because can then 'join' this search table with the original data table to get results and the original data in one mysql query.
The application then doesn't have to connect to sphinx itself. SphinxSE does it for you.
http://sphinxsearch.com/docs/current.html#sphinxse
Do I need to convert the database engine from InnoDB to Sphinx?
No. You keep the original data where it is, using what ever engine you like. Sphinx just provides an 'index' - it doesnt store the original data*. Its not a database as such, just provides for fast quering with its highly optimized indexing.
Basically you ask sphinx for the unique id's of documents matching a certain query. Then use those ids to lookup the data. SphinxAPI, sphinxSE and sphinxQL are just three different mechanisms of doing that.
Also, from what it seems, Sphinx can only index one (1) database table per configuration,
No. A single sphinx instance can host many indexes. And an index can have many sources. So can just create one index per table. Or if you mainly want to search them together, can just create one amalgamated index.
--
** Edit to reply to question in comments: **
When you say that, sphinx can host many indexes, is it relying solely in the sphinx.conf configuration file?
You would probably define one sphinx index per table. So you would need a source/index pair for each table. (unless you wanted to index all tables in one index, whihch is possible too.
It cant read the tables itself, and create config file, you have to define each index individually.
When you say "gives you a server that looks like a mysql one" do you mean like a proxy,
No. Not a proxy.
where my MySQL client can connect to this Sphinx port and the client will think that its a MySQL server?
Basically yes. The client will connect to it the same way it connects to a mysql-server.
If so, then I can execute both MySQL SQL queries and also SphinxQL at the same connection?
No. Impossible. Connect to mysql-server, to run mysql queries. Connect to searchd to run sphinxQL queries.
Two connections, one per server.
why my MySQL Workbench can't connect to port 9306,
Don't know. Might be a firewall issue.
Related
The access database is on server in folder. I need to create a stored procedure to connect to the access database and update the table data. It can be truncate then an insert. It is connecting via stored procedure to the access database i cannot figure out. It has to be done via a job on a schedule.
MySQL (the Sun- then Oracle- owned product) lacks the plumbing to connect to external tables unless they're on other MySQL servers. That is, it only has a FEDERATED storage engine. So, with MySQL you'll have to find some other way to handle your requirement; a MySQL event or other stored code cannot hit your Access tables.
MariaDB, the MySQL fork, has a CONNECT storage engine. It allows the server to hit external tables via ODBC, so you can hit Access with it. MariaDB is almost entirely compatible with MySQL, so maybe you can replace your MySQL server with it. The CONNECT documentation says this, however.
...these table types cannot be ranked as stable. Use them with care in production applications.
To me, that warning means don't do it!. Especially with a busy business-critical application (like a credit department might use) you don't want even a little bit of instability. If you truncate a table and then the reload fails, you'll be able to hear users yelling from the next county.
Your requirement is, I believe, to extract the contents of one (or more) Access tables and import them into a MySQL table. That kind of operation is called extract-transform-load etl. It seems you use SSIS for the purpose. That should work, because SSIS can connect to Access (of course) and to MySQL via the Connector/net or Connector/ODBC drivers.
But, scheduled SSIS packages get run from SQL Server database servers. You didn't say you have one of those at your disposal. If your org does have a production SQL Server instance, you can put your Access - to - MySQL package into it.
Otherwise you will have to figure out a way to run your scheduled etl job without relying on a database job (or event, as they're called in the MySQL world). For that you'll use the Task Scheduler on Windows, or a cronjob on a UNIX-derived OS like Linux or FreeBSD.
I bet you can do this work reliably from a Windows PowerShell script or a Linux shell script.
I have an Express(Node.js) app which uses MySQL queries.
I do not have a good MySQL hosting, but only PostgreSQL hosting. So, I want to use PostgreSQL.
I do not want to change the code as it is very large.
Is there any way I can edit the db connection file only, in such a way that the things work correctly?
I am new to databases, have done my basic "homework" regarding the theoretical part, and set about using MySQL Server through MySQL Workbench.
I have created four "connections" which appear on the Workbench homescreen dashboard, and I have also created some tables. But when I login through any connection (using user name and password), I can see all of the tables that I have created. So can anyone please tell me what is the point behind multiple connections then? What exactly is a "Connection" in MySQL Workbench?
I tried googling it, searched it on StackOverflow, and even referred the user manual of MySQL workbench, but got no answers.
Each MySQL connection contains its own set of definitions. For example, the connections might connect to different MySQL servers, or the same MySQL server with different usernames, or enable SSL for one, or you might set up a connection to a remote MySQL server using the SSH options, and so on.
As for multiple connections to the same local MySQL server, you might have one connection using "root" with another using a less privileged user. Depending on how you set up the users, they may (or may not) both have rights to see and use the same databases (information).
So to summarize, connections simply connect to the MySQL server. If two connections use the same exact information then the results will be identical. However, that is not a common use case.
On my AWS RDS MySQL instance I have some databases I didn't explicitly create there (and have never seen on my local MySQL databases, or on other hosted databases I've worked with) and wonder what they are (and what I can do about them):
information_schema
mysql
performance_schema
innodb
The first three are filled with data that I don't understand (and are listed separately in my MySQL tools; e.g. I have no ability to control privileges for them separately), while the last is empty. Can I delete the innodb? What are the others (I assume I should leave them alone)?
Forgive what may turn out to be a naive MySQL or AWS question; I'm fairly new to both.
These are all normal.
Every MySQL installation has the mysql and information_schema databases. If you can't see them, then either you either don't have permission to see them, or whatever you're using to connect to the MySQL server is hiding them from you. Most newer MySQL installations also have performance_schema.
The innodb database on RDS isn't really a database, but it shows up in the list because of the way the design of RDS interacts with MySQL server's internal concept that each directory inside that datadir is assumed to be a database. Files that InnoDB uses internally are stored there, even though the "database" itself appears to be empty. Just disregard it.
The mysql database contains tables used internally by MySQL, including the grant tables and time zone tables, and some DBA tools in the form of stored procedures that are specific to RDS, which are required due to the restricted access that even the administrator account has to an RDS instance, when compared to a standalone MySQL server.
http://dev.mysql.com/doc/refman/5.6/en/information-schema.html
http://dev.mysql.com/doc/refman/5.6/en/performance-schema.html
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.MySQL.CommonDBATasks.html
I use Mysql query browser on my pc for data entry,appreciate that let me how can i update my table on server after enter new records in Mysql query browser? is there any way that we sync to table(on server and on client )and sending new records to server?
thanks
If you want to keep your local and remote MySQL databases in sync, the obvious solution would be to use the replication features built into MySQL.
It sounds as if you have 2 data stores - one local, and one remote. Your question doesn't explicitly state that you actually have 2 separate databases, only that you're using MySQL Query Browser. You mention the MySQL Query Browser is on your PC, but it's not clear which database(s) it's connecting to. Is it a local database? Remember: the MySQL Query Browser is just an application that connects to a MySQL database.
It sounds as if you're looking for replication between MySQL servers. You mention 'sending new records' to the 2nd server. Are you looking for delete & update operations to be synchronized as well? A bit more information/requirements are needed before deciding on a solution.
The MySQL docs on Replication will get you started on replication, if that's the solution you need. This assumes your database hosts are in a master-slave relationship. That is, there is one good copy of data, and the other is to be a mirror for the master.