Thinking Sphinx indexing authorisation - thinking-sphinx

Fresh installation on Ubuntu. ran:
sudo apt-get update
sudo apt-get install mysql-client
sudo apt-get install sphinx search
RAILS_ENV=development bundle exec rake ts:configureruns properly, but when
RAILS_ENV=development bundle exec rake ts:index is invoked, all indices are returning
indexing index 'whatever_core'...
ERROR: index 'whatever_core': sql_connect: fe_sendauth: no password supplied
(DSN=pgsql://main:***#localhost:5432/same_development).
Thinking_sphinx.yml is configured as:
development:
bin_path: /usr/bin
pid_file: /home/main/same/shared/tmp/searchd.pid
configuration_file: /home/main/same/shared/config/development.sphinx.conf
indices_location: /home/main/same/shared/sphinx
use_64_bit: true
# enable_star: true
min_infix_len: 2
# max_matches: 1000
mysql41: 9313
mem_limit: 128M
utf8: true
this authentication has never been an issue previously... not sure what to make of it.

verify database.ymlthat it has proper username and password configuration.

Related

Error in docker-compose's MariaDB when it is restarted [duplicate]

I configured 3 drives on my machine: 1 for data files, 1 for transaction logs files, and 1 for temporary files.
I would like to initialize MariaDB at its first run straight after yum installation. Here are my steps:
created /etc/my.cnf with the following parameters
[mysqld]
aria-log-dir-path=/tempdb/mysql/
datadir=/data/mysql/
tmpdir=/tempdb/mysql/
innodb_data_home_dir=/data/mysql/
innodb_log_group_home_dir=/tlogs/mysql/
innodb_undo_directory=/tlogs/mysql/
aria-log-dir-path=/tempdb/mysql/
install MariaDB
sudo yum -y update
sudo tee /etc/yum.repos.d/MariaDB.repo<<EOF
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF
sudo yum makecache fast
sudo yum -y install MariaDB-server MariaDB-client
sudo systemctl start mariadb
I get the following exception
Can't start server : Bind on unix socket: No such file or directory
Can anyone shed some light on what I'm doing wrong? is this the right procedure to achieve my goal?
Thx
Gianluca
need to set the socket parameter
[client]
socket=/tmp/mysql.sock
...
[mysqld]
...
socket=/tmp/mysql.sock
...

Error in docker-compose's mariadb when i restart it [duplicate]

I configured 3 drives on my machine: 1 for data files, 1 for transaction logs files, and 1 for temporary files.
I would like to initialize MariaDB at its first run straight after yum installation. Here are my steps:
created /etc/my.cnf with the following parameters
[mysqld]
aria-log-dir-path=/tempdb/mysql/
datadir=/data/mysql/
tmpdir=/tempdb/mysql/
innodb_data_home_dir=/data/mysql/
innodb_log_group_home_dir=/tlogs/mysql/
innodb_undo_directory=/tlogs/mysql/
aria-log-dir-path=/tempdb/mysql/
install MariaDB
sudo yum -y update
sudo tee /etc/yum.repos.d/MariaDB.repo<<EOF
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF
sudo yum makecache fast
sudo yum -y install MariaDB-server MariaDB-client
sudo systemctl start mariadb
I get the following exception
Can't start server : Bind on unix socket: No such file or directory
Can anyone shed some light on what I'm doing wrong? is this the right procedure to achieve my goal?
Thx
Gianluca
need to set the socket parameter
[client]
socket=/tmp/mysql.sock
...
[mysqld]
...
socket=/tmp/mysql.sock
...

Vagrant Box - Install MySql 5.7 using apt

I created a basic vagrant box based on ubuntu/trusty64.
When i "vagrant up" the machine and next "vagrant ssh" into it, everything is fine.
Next step would be to install latest mysql 5.7, so thats what i did:
wget http://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb
sudo dpkg -i mysql-apt-config_0.7.3-1_all.deb
sudo apt-get update
sudo apt-get install -y mysql-server
So it downloads configures etc... next an "interactive" shell appears, where are i am requested to type password and repeat.
MySql 5.7 is installed successfully in my machine...BUT:
I would like it to be installed during "vagrant up", thats why i modified Vagrantfile with:
config.vm.provision :shell, path: "bootstrap.sh"
In bootstrap.sh i added content:
wget http://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb
sudo dpkg -i mysql-apt-config_0.7.3-1_all.deb
sudo apt-get update
sudo apt-get install -y mysql-server
This fails completely... in console i can read it tries to configure mysql 5.5 and its dependencies.
But why?
If anybody could help with this issue, i would be really thankful.
Thanks and Greetings!
UPDATE
error message
==> default: There are no enabled repos.
==> default: Run "yum repolist all" to see the repos you have.
==> default: You can enable repos with yum-config-manager --enable <repo>
==> default: sudo: yum-config-manager: command not found
==> default: There are no enabled repos.
==> default: Run "yum repolist all" to see the repos you have.
==> default: You can enable repos with yum-config-manager --enable <repo>
==> default: mysqld: unrecognized service
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
The reason why vagrant is installing 5.5 instead of 5.7 is because ubuntu/trusty version might be ubuntu 14.04, default mysql version for ubuntu 14.04 is mysql 5.5.
Below is a vagrant file which automatically installs mysql 5.7, but I have configured centos6 here. Feel free to change the os and set that to ubuntu/trusty. Just do
mysql57_config.vm.box = 'ubuntu/trusty64'
Instructions:
mkdir mysql-5-7
cd mysql-5-7
Once you are in mysql-5-7 directory add these two files, Vagrantfile and bootstrap.sh file
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "centos/7"
config.vm.hostname = "mysql57"
config.vm.provision "shell", path: "bootstrap.sh"
config.vm.define "mysql57" do |mysql57|
end
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline: <<-SHELL
# sudo apt-get update
# sudo apt-get install -y apache2
# SHELL
end
bootstrap.sh
sudo yum install -y wget
wget https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
sudo yum install -y mysql57-community-release-el7-8.noarch.rpm
sudo yum -y update
sudo yum -y install mysql-server
sudo systemctl start mysqld
sudo systemctl enable mysqld
MYSQL_TEMP_PWD=`sudo cat /var/log/mysqld.log | grep 'A temporary password is generated' | awk -F'root#localhost: ' '{print $2}'`
mysqladmin -u root -p`echo $MYSQL_TEMP_PWD` password 'Passw0rd!'
cat << EOF > .my.cnf
[client]
user=root
password=Passw0rd!
EOF
Now please run below commands:
vagrant up
vagrant ssh
Ones you are in the machine connected to mysql: connect to mysql and provide below credentials~~
user: root
password: Passw0rd!
Somewhere in /etc/sudoers (or /etc/sudoers.d if it's included) you have to have
vagrant ALL=(ALL) NOPASSWD:ALL
Defaults:vagrant !requiretty
without that, the vagrant ssh (without tty) fails mysteriously.
If you are using MacOS, turn Off firewall and see it this works?

How to install mysql-server in Ubuntu

I have mariadb in my ubuntu system but it is not working properly , so i want to again install mysql in my system .
For Remove mariadb i have run these commands .
sudo apt-get --purge remove "mysql*"
sudo mv /etc/mysql/ /tmp/mysql_configs/
nano /etc/apt/sources.list
sudo apt-get update
sudo apt-get install mysql-server-5.6
but after step 5 it's give me these errors :
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
libmysqlclient18 : Depends: mysql-common (= 5.6.30-1ubuntu14.04)
mariadb-server-5.5 : Breaks: mysql-server-5.6
Breaks: virtual-mysql-server
mariadb-server-core-5.5 : Conflicts: mysql-server-5.6
mysql-server-5.6 : Depends: mysql-client-5.6 (>= 5.6.30-0ubuntu0.14.04.1)
Depends: mysql-server-core-5.6 (= 5.6.30-0ubuntu0.14.04.1)
Recommends: mysql-common-5.6 but it is not going to be installed
Breaks: virtual-mysql-server
W: Duplicate sources.list entry http://debian.datastax.com/community/ stable/main amd64 Packages (/var/lib/apt/lists/debian.datastax.com_community_dists_stable_main_binary-amd64_Packages)
W: Duplicate sources.list entry http://debian.datastax.com/community/ stable/main i386 Packages (/var/lib/apt/lists/debian.datastax.com_community_dists_stable_main_binary-i386_Packages)
W: You may want to run apt-get update to correct these problems
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
Can anyone give me suggestion how can i install mysql in my system . Thanks in advance .
First of all, you need to update the system.
sudo apt update && upgrade
then perform the MySQL installation commands and follow the instructions.
sudo apt install mysql-server
sudo mysql_secure_installation
Once it has done. try to open MySQL.
sudo mysql
try to check the authentication method each of your MySQL user accounts uses with the following command in the MySQL terminal:
SELECT user,authentication_string,plugin,host FROM mysql.user;
this will return users with authentication_string.
Change the MySQL root password with the following command.
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
FLUSH PRIVILEGES;
Flush Privileges which tells the server to reload the grant tables and put your new changes into effect
It's very simple to install mysql on ubuntu , just follow these steps :
Step 1 : update the system
sudo apt update
Step 2 : Install mysql package
sudo apt install mysql-server
Step 3 : Once the installation is completed, the MySQL service will start automatically. To check whether the MySQL server is running, type:
sudo systemctl status mysql
The output of the following command should be :
OUTPUT
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2018-06-20 11:30:23 PDT; 5min ago
Main PID: 17382 (mysqld)
Tasks: 27 (limit: 2321)
CGroup: /system.slice/mysql.service
`-17382 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
Step 4 : Securing MySQL
sudo mysql_secure_installation
select one of the three levels of password validation policy(strong recommended).Set your password ,and then type y(yes) to all the questions , this will improve the security .
Step 5 : Once it has done. open MySQL by typing the following command :
sudo mysql
Step 6 : If you want to login to your MySQL server as root from an external program such as phpMyAdmin , then type these commands inside mysql.
mysql>ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'strong_password';
mysql>FLUSH PRIVILEGES;
mysql>exit;
After this you will be successfully able to run mysql , for this open terminal and type.
mysql -u root -p
Now type your password.
Congo! you are done with installing mysql.
Lesson from continuous deployment test. You MUST do this purge mysql-common. You CANNOT put mariadb and mysql in the same system, they want their own mysql-common and not sharing them. Which many other API wrapped around it to connect to those server.
And you must comment all the repo pointing to mariadb. Otherwise it will install the same version again from mariadb.
sudo apt-get purge mysql-common
# Put back the mysql-common , make sure you use the new mysql repo,
# remarks mariadb repo
sudo apt-get install software-properties-common
Always check whether any OTHER file or folder contains mariadb repo.
cd /etc/apt
fgrep -lR "maria"
The easy way for this is installing the synaptic package manager by typing the following command in the terminal:
sudo apt-get install synaptic
And then open synaptic by:
sudo synaptic
Then search for the package you have installed, mariadb, and mark it for complete removal and press apply.
And these commands to install mysql-server
sudo apt-get update
sudo apt-get install mysql-server
It's quite easy to install mysql on Ubuntu.
sudo apt-get update
sudo apt-get install mysql-server
You'll be asked to create a new password for root user. Set a good password and you're ready to go.
You can also follow this youtube videos for installation and basic understanding for Mysql
sudo apt-get update
sudo apt-get install mysql-server -y
if setup password
sudo mysql_secure_installation
if set new user
sudo mysql
>CREATE USER 'username'#'%' IDENTIFIED BY 'password';
>FLUSH PRIVILEGES;
>exit
sudo systemctl restart mysql

thinking_sphinx connection via MySQL

Ubuntu 14.04 installation, with nginx, passenger and postgresql. The following steps are run:
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install mysql-server
sudo mysql_secure_installation _for allowing only localhost connection_
sudo apt-get install sphinxsearch
gem file has
gem 'mysql2', '0.3.18', :platform => :ruby
gem 'thinking-sphinx', '3.1.4'
thinking_sphinx.yml specifies
mysql41: 9312
Running:
RAILS_ENV=development bundle exec rake ts:rebuild
proceeds correctly: total 112 writes, 0.079 sec, 485.0 kb/call avg, 0.7 msec/call avg Started searchd successfully (pid: 21644).
netstat -ltnp shows only one searchd process
tcp 0 0 127.0.0.1:9312 0.0.0.0:* LISTEN 21644/searchd
So one concludes that everything is a go... right? [nasty buzzer]
ThinkingSphinx::ConnectionError
Error connecting to Sphinx via the MySQL protocol.
Error connecting to Sphinx via the MySQL protocol. _nice... stated twice!_
Can't connect to MySQL server on '127.0.0.1' (111)
Possible avenues for non-connection:
mySql-server root password not digested
nginx somehow impeding the connection
others? how to verify/assert?
While Sphinx implements the MySQL protocol for querying, it does not pay any attention to authentication, so Thinking Sphinx doesn't use those fields either. So I'm not sure if mysql_secure_installation is the right tool for the job - certainly, not if it's trying to use authentication to control access. If you don't want to allow external communication to Sphinx, can you just block the port?
Building on Pat's observation the following got me running on Ubuntu 14.04 installation, with nginx, passenger and postgresql.
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install mysql-server
sudo apt-get install sphinx search
Ensure gem file has
gem 'mysql2', '0.3.18', :platform => :ruby
gem 'thinking-sphinx', '3.1.4'
# alternately with JRuby
gem 'jdbc-mysql', '~> 5.1.28', :platform => :jruby
thinking_sphinx.yml must specify
mysql41: [port_number]
multiple search processes need distinct ports.
Configure, index and start via:
RAILS_ENV=[your_environment] bundle exec rake ts:rebuild
sudo netstat -ltnp should show the listen port as defined in thinking_sphinx.yml and rendered in config/[your_environment].sphinx.conf
tcp 0 0 127.0.0.1:[port_number] 0.0.0.0:* LISTEN 21644/searchd
Finally,
sudo reboot