starting piler service can't connect to mysql server

Issue #840 resolved
Francesco created an issue

Hi,

I've seen many issues closed time ago that i've my same problem.

I've install everything on my centos 7 vps and everything works fine, i've check piler.conf in order to see if mysql settings are wrong but nothing, everything is fine.

But when i start rc.piler service i've this error :

starting piler . . .
cant connect to mysql server

where can i fix this error? Thanks

Comments (22)

  1. Janos SUTO repo owner

    Try to connect to mysql manually using the exact parameters in piler.conf. Also be sure that piler user can actually read piler.conf.

    Anyway it's most likely a pebkac, rather than a major bug in piler, sorry.

  2. Martin

    Issue +1

    I'm setting up Jessie 8.9 in Hyper-V with Piler 1.3.0 and get the same issue, when starting Piler (#/etc/init.d/rc.piler start).

    I'm backing up several steps, while installing. When I install Piler 1.2.0 in the very same VM, everything works fine.

    When I run 'pilerconf | grep mysql output' as root (su) from /root/piler-1.3.0, 'output' is empty.

  3. Martin

    A full monitor... And a bit too much to write here.

    According to mySQL:

    #!
    
    mysqlhost=
    mysqlport=0
    mysqlsocket=/tmp/mysql.sock
    mysqluser=piler
    mysqlpwd=
    mysqldb=piler
    mysql_connect_timeout=2
    

    Difference between 1.3.0 and 1.2.0

    #!
    
    1.3.0: extra_to_field=
    1.2.0: extra_to_field=X-Envelope-To:
    
    1.3.0: hostid=mailarchiver
    1.2.0: hostid=piler.yourdomain.com
    
    1.3.0: mysqlsocket=/var/run/mysql/mysql.sock
    1.2.0: mysqlsocket=/tmp/mysql.sock
    
    1.3.0: pemfile=
    1.2.0: pemfile=/usr/local/etc/piler/piler.pem
    

    All the rest is the same...

  4. Martin

    /usr/local/etc/piler/piler.conf on 1.2.0 and 1.3.0

    On 1.3.0 the file is empty... Or do I miss the right one? And there is a second which contains what it should?

  5. Janos SUTO repo owner

    I'm confused. You say "/usr/local/etc/piler/piler.conf on 1.2.0 and 1.3.0", and still 1.3.0 can't find it? Are you speaking about two different installations?

  6. Martin

    Sorry, that was indeed confusing. I'm backing up several steps of the VM, so I can use the same basic installation, to finish up with two different machines: One with Piler 1.2.0 and one with Piler 1.3.0. Those two VMs I compare with each other to see what the difference is.

  7. Janos SUTO repo owner

    1.3.0 doesn't create piler.conf. Rather it creates piler.conf.dist. You may copy it to piler.conf, then customize it.

  8. Martin

    Thanks! I see. What was in piler.conf, now is found in piler.conf.dist. Inside, there is a pw for "mysqlpw=". On calling pilerconf, I get an empty space for the password. Logging on to mysql with user "piler" there is also no pw set.

    Nevertheless piler cannot connect to mysql.

    Do I miss some point here? I redid all the installation twice...

  9. Janos SUTO repo owner

    Now check again pilerconf|grep mysql output, and show it to me (use **** for the password)

  10. Martin

    'pilerconf | grep mysql output' as root (su) from /root/piler-1.3.0 leaves an empty file.

    Touching 'output' anywhere else and running this command also leaves an empty file. Do I do something wrong?

  11. Janos SUTO repo owner

    Dear Lord! is this for real? 'pilerconf | grep mysql output' Did I tell you to run this command? Not at all! Please show me your piler.conf file or I'm just wasting my time with you.

  12. Martin

    It is often quoted, that Linux has what it takes to leave behind all other OSs. Only reason why this never will happen is that people who know are too stuck-up to answer people who ask.

    Sorry, I am still learning and I am not getting everything at first sight. Maybe I also was too starry-eyed, because I thought not asking for help, but reporting a bug.

    Now I see, that you ment “pilerconfig | grep mysql” output. Quotation marks would be helpfull. I understood “pilerconfig | grep mysql > output”, but missed that “>” is needed.

    I already posted what one of those commands brings two days ago. There is also a comparison between the differences of the whole result of pilerconf, using piler 1.2.0 and piler 1.3.0.

    To fulfill your request once more and not leaving the feeling of wasting your time:

    #!
    
    mysqlhost=
    mysqlport=0
    mysqlsocket=/tmp/mysql.sock
    mysqluser=piler
    mysqlpasswd=
    mysqldb=piler
    mysql_connect_timeout=2
    

    Not to miss a thing: Last you ask for the whole piler.conf. This file is empty on 1.3.0. As you told me before, it's replaced by piler.conf.dist. Here is what I found in piler.conf.dist:

    #!
    
    archive_emails_not_having_message_id=0
    archive_only_mydomains=0
    backlog=20
    cipher_list=ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS
    clamd_socket=/tmp/clamd
    default_retention_days=2557
    enable_chunking=0
    enable_cjk=0
    enable_folders=0
    encrypt_messages=1
    extract_attachments=1
    extra_to_field=X-Envelope-To:
    helper_timeout=20
    hostid=piler.yourdomain.com
    listen_addr=0.0.0.0
    listen_port=25
    max_requests_per_child=1000
    memcached_servers=127.0.0.1
    memcached_to_db_interval=900
    memcached_ttl=86400
    min_message_size=100
    min_word_len=1
    mmap_dedup_test=0
    mysql_connect_timeout=2
    mysqldb=piler
    mysqlpwd=verystrongpassword
    mysqlsocket=/var/run/mysqld/mysqld.sock
    mysqluser=piler
    number_of_worker_processes=10
    pemfile=/usr/local/etc/piler/piler.pem
    pidfile=/var/run/piler/piler.pid
    piler_header_field=X-piler-id:
    process_rcpt_to_addresses=0
    server_id=0
    spam_header_line=
    syslog_recipients=0
    tls_enable=0
    tweak_sent_time_offset=0
    update_counters_to_memcached=0
    username=piler
    verbosity=1
    workdir=/var/piler/tmp
    

    Following another post by you, I did:

    #!
    
    
    #mv piler.conf piler.conf.old
    #cp piler.conf.dist piler.conf
    #reboot
    

    With this the problem still lasts.

    Please feel free to immediately close this request, if you come to the point that this is not about bug tracing, but a kind of support abuse.

    Thanks.

  13. Janos SUTO repo owner

    OK, I try it one more time. Piler uses a config file, it's /usr/local/etc/piler/piler.conf (unless you have specified --prefix or --sysconfdir to point to somewhere else).

    If you don't have this file, piler won't work. And based on the pilerconf|grep mysql results I bet you don't have the file. And please pay attention to what I ask you to do. Because I didn't ask you to show me piler.conf.dist. I know how it looks, since I've made it.

    But what I DID ASK YOU is to show me your /usr/local/etc/piler/piler.conf file. But you didn't. So one more time: can you and will you do so?

  14. Martin

    Not needed. With your help, I made it work. Tripple thanks to you!

    1. For the background information, which made me to understand the problem.
    2. For your very clear advice in the last post, which showed me how to solve the problem.
    3. For doing all this for the community.

    So for everyone, who has problems to connect Piler 1.3.0 to MySQL I'd like to leave a few words, because I guess a few people will end up here. Most of them will be learners like me.

    Whilst Piler 1.2.0 automatically produces a needed and working file /usr/local/etc/piler/piler.conf, Piler 1.3.0 will not do. You'll have to do it by hand. To do so:

    #!
    
    1. #mv /usr/local/etc/piler/piler.conf /usr/local/etc/piler/piler.conf.old
    2. #cp /urs/local/etc/piler/piler.conf.dist /usr/local/etc/piler/piler.conf
    3. #nano /usr/local/etc/piler/piler.conf
        => At least change the password in line "mysqlpwd=verystrongpassword"
    

    So last question: Is this a problem in Debian only, or is it a kind of side effect that you would not judge as bug? Or maybe something people need to learn properly using Piler? Just a question of interest, every answer will be respected and not be discussed.

  15. Janos SUTO repo owner

    It's not a debian only problem if you will, it's an intentional feature to prevent accidental overwrite of current piler.conf to write piler.conf.dist. Perhaps some more emphasis in the documentation might be required to clarify this behaviour.

  16. Log in to comment