Openshift Mysql 5.5 cartridge how to access logs? - mysql

I need to review the mysql 5.5 server logs but I cannot find a way to get access them via ssh, sftp or mysqlworkbench. The mysql cartridge is in a scaled application. A solution?

There are a couple things here I'd like to point out that should provide some more information on how things work and how to get to the information you're looking for.
Scalable applications with DB's actually have the DB running in a separate gear than the application framework (for scaling purposes). For instance, if you ran rhc app show <appname> --gears for one of your scalable applications you would see that there are 2 gears being used and that the ssh information for each of them is different. So if you're just looking to take a quick look at your logs via ssh, you'll need to ssh into the appropriate gear to get to them.
You will need to use the rhc port-forward command to forward the right local ports to your database gear and then be able to connect mysqlworkbench from there.

Related

MySql how to collaborate remotely ona project

Me and my friend have to do a project in Mysql and i am trying to find how me and my friend can work on mysql together from our own workstations. Is there a way where we both can work on the same database together without being physically present.
I am fairly new to mysql.
Just take cheap shared hosting that has MySQL databases and preferably also PHPmyAdmin and cPanel or any other panel to easily manage your databases. In that way, you have minimum hassle to create and manage databases that you can both access.
Google "compare cheap shared hosting" and that's it. Or take this quick Google result I got: https://www.pcmag.com/picks/the-best-cheap-web-hosting-services
If you're not happy to pay $1-$2 per month for hosting then you can install WAMPP or XAMPP on Windows machine but then you'll have to also Google how to forward ports from your router.
Edited 3aug2020: For a free MySQL hosting for up to 5MB free storage please, check https://www.freemysqlhosting.net
You can use a program like XAMPP to host mysql and port-forward phpmyadmin so your friend can visit your db
https://www.apachefriends.org/index.html
If you have MYSQL running on a server or your local computer you can both access phpmyadmin (http://server-ip/phpmyadmin) you can also use programs like Navicat (paid) or HeidiSQL (Free).
You can make the database remotely accessible, in which case your friend can connect and work on it as well.
Without knowing more about your network setup it is difficult to say how you should proceed, but generally it is enough to spin up a mysql-server instance on the host machine, then forward a WAN port to the LAN address and port of the host machine.

Database services on new vps

There are services like ServerPilot and many others that install on a vps that handle the lamp stack env. I'm wondering if there is a service that does this for databases. I install the service on a fresh vps and that the service would do all the heavy lifting like security, replication, separate read writes, back-ups and monitoring a long with easily setting up private network access for a set fee to use that service on my server.
Looking for a simple service to install on my own fresh vps, not RDS or Google Cloud.
Thank you!
What Does ServerPilot Really Do?
First, ServerPilot deploys complete LAMP stack on your server and that’s including world’s most used web server Apache, PHP5, and MYSQL. To make it even super, ServerPilot also installs and configures Nginx in front of Apache to achieve unbeatable speed and scalability.
Secondly, ServerPilot will secure your server with a firewall. To make it even secure, it will also update your server’s packages and make sure they stay updated all the time to avoid even single bug caused by outdated package.
Thirdly, ServerPilot also offers a premium feature to monitor real-time stats of your server’s performance including CPU, memory, disk space, and more.
What Does ServerPilot Not Do?
Meanwhile Serverpilot does not provide features related to installing, configuring and managing email and DNS. In this case you may need third-party DNS server to be able to point your domain to your VPS. Need recommendations? Try CloudFlare, PointHQ, NameCheap, etc.
Also, ServerPilot does not manage your server running other than Ubuntu.
Get more details at : http://www.servermom.org/install-manage-apache-nginx-php-mysql-easiest-serverpilot/1011/
I'm not sure about services, but assuming that your VPS is Ubuntu or some other Debian-based distro, you could perform sudo apt-get install lamp-server^ phpmyadmin on the command line to get your LAMP stack setup. This will setup Apache web server, PHP, and MySQL on your Linux server. Apache and PHP will come working out-of-the-box, and when you install MySQL, by default it asks for a root password to manage the database.
phpMyAdmin would be the key here because instead of doing all your database tasks via the command line, it provides a GUI interface in your web browser to manage databases and tables. To backup your database with phpMyAdmin, see this article.
With regards to customizations, for the firewall you can simply write a few iptables rules and for the database, you can run scheduled backups of a MySQL database by creating a cron job that runs the following command:/usr/bin/mysqldump -u dbusername -p'dbpassword' dbname > /path/backup.sql
Again, this isn't a service, but at least you wouldn't have to pay for any of the tools.
Unfortunately, there is no ultimate service than can perform all this stuff. However, you can set up this manually:
Database replication:
https://www.digitalocean.com/community/tutorials/how-to-set-up-master-slave-replication-in-mysql
Database backup:
http://www.ducea.com/2006/05/27/backup-your-mysql-databases-automatically-with-automysqlbackup/
or
https://www.backuphowto.info/how-backup-mysql-database-automatically-linux-users
Database optimization:
https://www.tecmint.com/mysql-mariadb-performance-tuning-and-optimization/
and
http://www.monitis.com/blog/101-tips-to-mysql-tuning-and-optimization/
And for the networking, this tutorial may be helpful
http://www.yolinux.com/TUTORIALS/LinuxTutorialNetworking.html

Gear to gear connection (Please read the full description first)

I have checked almost all solutions both in Openshift forum and here in stackoverflow but couldn't solve the problem.
Here is the situation
I have a php server with load balancing in one gear.
I have a second gear for mysql server along with PhpMyAdmin. At present OpenShift does not support load balancing for PhpMyAdmin, so my second gear does not have any scaling feature.
Now I want to host a php app in first gear and the database in the second gear. So how do I connect them internally (would be better if I could do it without port forwarding)? I need all the commands from the beginning to the end unfortunately.
Thank you.
You should just add the mysql cartridge to your scaled application. It will still put the mysql database on it's own gear, but it will be accessible from your scaled application using the standard mysql environment variables. You can view those variables by sshing into your application and running env | grep mysql. If you decide to run your own second gear for the mysql database (you still had to install a web cartridge anyways to do that right?) then you will either HAVE to use port forwarding for direct access, or you will have to write an API on that server that will allow your application to access the mysql database.

OpenShift Online proxy port

Is there any workaround to lack of proxy port in OpenShift Online?
Why I need it? I've got three application gears. All of them run JBoss. One of them run additionaly MySql.
I need to make three ports (3306, 5445, 5455 - mysql and HornetQ) from gear with MySQL available to other gears (HornetQ to one and MySQL to another). Is there a way to do it?
If you create a scalable application then you can access MySQL gear from other applications. Lets suppose you create a scalable application using JBoss and MySQL then OpenShift would install MySQL and JBoss on separate gears.This would allow other applications to access the MySQL database.

Hudson cmd.exe running as

Where does hudson CI get user to run the cmd.exe ?
I'm trying to start and stop some remote services on various slaves and special credentials that are different than what hudson is using are needed. I can't find a place to override the user. I've tried running the server as various users, but it doesn't change anything.
Any other ideas?
Since you want to start and stop the services on the remote machine you need to login with these credentials on the remote machine, since I haven't found a way to start and stop a service on remote machine.
There are different ways to do that. You can create a slave that runs on the remote machines with the correct credentials. You can even create more than one slave for the same machine without any issues, than you can use different credentials for the same machine. These can then fire up the net stop and net start command.
You can also use the SSH plugin. This allows you to configure pre- and post-build ssh scripts. You 'just' need and ssh server on the windows machine. The password for the connection will be stored encrypted.
Use a commad line tool. So far I haven't found a Windows on board tool to have a scripted login to the remote machine. I would use plink for that task. plink is the scripted version of putty. Putty supports different connection types. So you can also use the build in telnet service (not recommended since telnet does not encrypt the connection). Disadvantage is that you will have the password unencrypted in the job configuration.
We had a similar problem, and I resorted to using PsExec. To my advantage, our machines exist on a separate LAN, within 2 firewalls, so I was OK with unencrypted passwords floating around. I had also explored SSH w/ Putty, which seemed to work, but not straightforward.
If someone can help with single line runas command, that could work too.
You don't say how your slaves are connected to Hudson, but I'll assume it's through the "hudson slave" service, since that's probably the most popular way to connect Windows slaves.
If so, the CMD.EXE is run with the same permissions as the user running the service. This can be checked by:
1. run services.msc
2. double-click hudson-slave service
3. go to Log On tab
By default, the slave service runs as "LocalSystem", which is the most powerful account on the system. It should be able to do whatever you need it to do. (i.e. start/stop services)